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 209998
Collapse All | Expand All

(-)a/api.openfile/arch.xml (+1140 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
<!--
15
        <question id="arch-overall" when="init">
16
            Describe the overall architecture.
17
            <hint>
18
            What will be API for
19
            <a href="http://wiki.netbeans.org/API_Design#Separate_API_for_clients_from_support_API">
20
                clients and what support API</a>?
21
            What parts will be pluggable?
22
            How will plug-ins be registered? Please use <code>&lt;api type="export"/&gt;</code>
23
            to describe your general APIs and specify their
24
            <a href="http://wiki.netbeans.org/API_Stability#Private">
25
            stability categories</a>.
26
            If possible please provide simple diagrams.
27
            </hint>
28
        </question>
29
-->
30
    <answer id="arch-overall">
31
        <p>
32
            This module provides SPI for implementing custom filters
33
            for Open File Dialog. These filters can be registered using
34
            <code>ServiceProvider</code>.
35
        </p>
36
        See <api group="java"
37
             name="OpenFileDialogFilter"
38
             type="export"
39
             category="devel"
40
             url="@TOP@org/netbeans/spi/openfile/OpenFileDialogFilter.html">
41
            SPI for defining custom Open File Dialog filters.
42
        </api>
43
    </answer>
44
45
46
47
<!--
48
        <question id="arch-quality" when="init">
49
            How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html">quality</a>
50
            of your code be tested and
51
            how are future regressions going to be prevented?
52
            <hint>
53
            What kind of testing do
54
            you want to use? How much functionality, in which areas,
55
            should be covered by the tests? How you find out that your
56
            project was successful?
57
            </hint>
58
        </question>
59
-->
60
    <answer id="arch-quality">
61
        <p>
62
            There are several unit tests in the module.
63
            The project was successfull if filters work the same way they
64
            worked before
65
            <code>OpenFileDialogFilter</code> was moved from
66
            module
67
            <code>utilities</code>.
68
        </p>
69
    </answer>
70
71
72
73
<!--
74
        <question id="arch-time" when="init">
75
            What are the time estimates of the work?
76
            <hint>
77
            Please express your estimates of how long the design, implementation,
78
            stabilization are likely to last. How many people will be needed to
79
            implement this and what is the expected milestone by which the work should be
80
            ready?
81
            </hint>
82
        </question>
83
-->
84
    <answer id="arch-time">
85
        <p>
86
            The code was only moved from module
87
            <code>utilities</code> to a new module and made public.
88
            Several tests were implemented. Only a few days was needed.
89
            The work should be ready before NetBeans 7.3 Beta.
90
        </p>
91
    </answer>
92
93
94
95
<!--
96
        <question id="arch-usecases" when="init">
97
            <hint>
98
                Content of this answer will be displayed as part of page at
99
                http://www.netbeans.org/download/dev/javadoc/usecases.html
100
                You can use tags &lt;usecase name="name&gt; regular html description &lt;/usecase&gt;
101
                and if you want to use an URL you can prefix if with @TOP@ to begin
102
                at the root of your javadoc
103
            </hint>
104
105
            Describe the main <a href="http://wiki.netbeans.org/API_Design#The_Importance_of_Being_Use_Case_Oriented">
106
            use cases</a> of the new API. Who will use it under
107
            what circumstances? What kind of code would typically need to be written
108
            to use the module?
109
        </question>
110
-->
111
    <answer id="arch-usecases">
112
        <p>
113
            The module is important for implementators of modules that support
114
            opening of custom file types.
115
        </p>
116
    </answer>
117
118
119
120
<!--
121
        <question id="arch-what" when="init">
122
            What is this project good for?
123
            <hint>
124
            Please provide here a few lines describing the project,
125
            what problem it should solve, provide links to documentation,
126
            specifications, etc.
127
            </hint>
128
        </question>
129
-->
130
    <answer id="arch-what">
131
        <p>
132
            The module lets clients add file filters to open file dialog.
133
        </p>
134
        <p>
135
            For example if a module adds support for files with extension,
136
            lets say, .xyz, Open File dialog will offer this file type in
137
            its list of filters.
138
        </p>
139
    </answer>
140
141
142
143
<!--
144
        <question id="arch-where" when="impl">
145
            Where one can find sources for your module?
146
            <hint>
147
                Please provide link to the Hg web client at
148
                http://hg.netbeans.org/
149
                or just use tag defaultanswer generate='here'
150
            </hint>
151
        </question>
152
-->
153
    <answer id="arch-where">
154
        <defaultanswer generate='here' />
155
    </answer>
156
157
158
159
<!--
160
        <question id="compat-deprecation" when="init">
161
            How the introduction of your project influences functionality
162
            provided by previous version of the product?
163
            <hint>
164
            If you are planning to deprecate/remove/change any existing APIs,
165
            list them here accompanied with the reason explaining why you
166
            are doing so.
167
            </hint>
168
        </question>
169
-->
170
    <answer id="compat-deprecation">
171
        <p>
172
            This module deprecates legacy class
173
            <code>org.netbeans.modules.openfile.OpenFileDialogFilter</code>
174
            in module
175
            <code>utilities</code>. This location for this class is
176
            not semantically correct and implementation or friend dependency
177
            is required to use it. Making this API public in a more appropriate
178
            module has been requested by many users. See bug #209998.
179
        </p>
180
        <p>
181
            The project will influence modules with friend or implementation
182
            dependency on module
183
            <code>utilities</code> that use legacy abstract class
184
            <code>OpenFileDialogFilter</code> in package
185
            <code>org.netbeans.modules.openfile</code>.
186
            This class is still there, but it is marked as deprecated and will
187
            be probably removed soon.
188
        </p>
189
        <p>
190
            The change is known to cause an error if the legacy class is
191
            implemented and registered as service with the
192
            <code>supersedes</code> annotation. Example:
193
        </p>
194
            <pre>
195
                <code>@ServiceProvider(service = OpenFileDialogFilter.class,
196
position = 100,
197
supersedes = {
198
    "org.netbeans.modules.openfile.FileChooser$TxtFileFilter",
199
    "org.netbeans.modules.openfile.FileChooser$JavaFilesFilter"
200
})
201
public class OpenFileFilter extends OpenFileDialogFilter.ExtensionFilter {
202
    // ...
203
}                </code>
204
            </pre>
205
        <p>
206
            As class
207
            <code>org.netbeans.modules.openfile.FileChooser$TxtFileFilter</code>
208
            now extends the new SPI class, not the legacy one, it is not allowed
209
            to supersede it by any subclass of the legacy interface.
210
        </p>
211
    </answer>
212
213
214
215
<!--
216
        <question id="compat-i18n" when="impl">
217
            Is your module correctly internationalized?
218
            <hint>
219
            Correct internationalization means that it obeys instructions
220
            at <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html">
221
            NetBeans I18N pages</a>.
222
            </hint>
223
        </question>
224
-->
225
    <answer id="compat-i18n">
226
        <p>
227
            The module is correctly internationalized.
228
        </p>
229
    </answer>
230
231
232
233
<!--
234
        <question id="compat-standards" when="init">
235
            Does the module implement or define any standards? Is the
236
            implementation exact or does it deviate somehow?
237
        </question>
238
-->
239
    <answer id="compat-standards">
240
        <p>
241
            The module does not implement nor define any standards.
242
        </p>
243
    </answer>
244
245
246
247
<!--
248
        <question id="compat-version" when="impl">
249
            Can your module coexist with earlier and future
250
            versions of itself? Can you correctly read all old settings? Will future
251
            versions be able to read your current settings? Can you read
252
            or politely ignore settings stored by a future version?
253
254
            <hint>
255
            Very helpful for reading settings is to store version number
256
            there, so future versions can decide whether how to read/convert
257
            the settings and older versions can ignore the new ones.
258
            </hint>
259
        </question>
260
-->
261
    <answer id="compat-version">
262
        <p>
263
            No settings are read and stored.
264
        </p>
265
    </answer>
266
267
268
269
<!--
270
        <question id="dep-jre" when="final">
271
            Which version of JRE do you need (1.2, 1.3, 1.4, etc.)?
272
            <hint>
273
            It is expected that if your module runs on 1.x that it will run
274
            on 1.x+1 if no, state that please. Also describe here cases where
275
            you run different code on different versions of JRE and why.
276
            </hint>
277
        </question>
278
-->
279
    <answer id="dep-jre">
280
        <p>
281
            JRE version 1.6 is needed.
282
        </p>
283
    </answer>
284
285
286
287
<!--
288
        <question id="dep-jrejdk" when="final">
289
            Do you require the JDK or is the JRE enough?
290
        </question>
291
-->
292
    <answer id="dep-jrejdk">
293
        <p>
294
            JRE is enough.
295
        </p>
296
    </answer>
297
298
299
300
<!--
301
        <question id="dep-nb" when="init">
302
            What other NetBeans projects and modules does this one depend on?
303
            <hint>
304
            Depending on other NetBeans projects influnces the ability of
305
            users of your work to customize their own branded version of
306
            NetBeans by enabling and disabling some modules. Too
307
            much dependencies restrict this kind of customization. If that
308
            is your case, then you may want to split your functionality into
309
            pieces of autoload, eager and regular modules which can be
310
            enabled independently. Usually the answer to this question
311
            is generated from your <code>project.xml</code> file, but
312
            if it is not guessed correctly, you can suppress it by
313
            specifying &lt;defaultanswer generate="none"/&gt; and
314
            write here your own. Please describe such projects as imported APIs using
315
            the <code>&lt;api name="identification" type="import or export" category="stable" url="where is the description" /&gt;</code>.
316
            By doing this information gets listed in the summary page of your
317
            javadoc.
318
            </hint>
319
        </question>
320
-->
321
    <answer id="dep-nb">
322
        <defaultanswer generate='here' />
323
    </answer>
324
325
326
327
<!--
328
        <question id="dep-non-nb" when="init">
329
            What other projects outside NetBeans does this one depend on?
330
331
            <hint>
332
            Depending on 3rd party libraries is always problematic,
333
            especially if they are not open source, as that complicates
334
            the licensing scheme of NetBeans. Please enumerate your
335
            external dependencies here, so it is correctly understood since
336
            the begining what are the legal implications of your project.
337
            Also please note that
338
            some non-NetBeans projects are packaged as NetBeans modules
339
            (see <a href="http://libs.netbeans.org/">libraries</a>) and
340
            it is preferred to use this approach when more modules may
341
            depend and share such third-party libraries.
342
            </hint>
343
        </question>
344
-->
345
    <answer id="dep-non-nb">
346
        <p>
347
            There are no external dependencies.
348
        </p>
349
    </answer>
350
351
352
353
<!--
354
        <question id="dep-platform" when="init">
355
            On which platforms does your module run? Does it run in the same
356
            way on each?
357
            <hint>
358
            If you plan any dependency on OS or any usage of native code,
359
            please describe why you are doing so and describe how you envision
360
            to enforce the portability of your code.
361
            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
362
            enabled modules</a> which together with autoload/eager modules
363
            can allow you to enable to provide the best OS aware support
364
            on certain OSes while providing compatibility bridge on the not
365
            supported ones.
366
            Also please list the supported
367
            OSes/HW platforms and mentioned the lovest version of JDK required
368
            for your project to run on. Also state whether JRE is enough or
369
            you really need JDK.
370
            </hint>
371
        </question>
372
-->
373
    <answer id="dep-platform">
374
        <p>
375
            The module is platform-independent.
376
        </p>
377
    </answer>
378
379
380
381
<!--
382
        <question id="deploy-dependencies" when="final">
383
            What do other modules need to do to declare a dependency on this one,
384
            in addition to or instead of the normal module dependency declaration
385
            (e.g. tokens to require)?
386
            <hint>
387
                Provide a sample of the actual lines you would add to a module manifest
388
                to declare a dependency, for example OpenIDE-Module-Requires: some.token.
389
                If other modules should not depend on this module, or should just use a
390
                simple regular module dependency, you can just answer "nothing". If you
391
                intentionally expose a semistable API to clients using implementation
392
                dependencies, you should mention that here (but there is no need to give
393
                an example of usage).
394
            </hint>
395
        </question>
396
-->
397
    <answer id="deploy-dependencies">
398
        <p>
399
            There are no special requirements for declaring dependencies.
400
        </p>
401
    </answer>
402
403
404
405
<!--
406
        <question id="deploy-jar" when="impl">
407
            Do you deploy just module JAR file(s) or other files as well?
408
            <hint>
409
            Usually a module consist of one JAR file (perhaps with Class-Path
410
            extensions) and also a configuration file that enables it. If you
411
            have any other files, use
412
            &lt;api group="java.io.File" name="yourname" type="export" category="friend"&gt;...&lt;/api&gt;
413
            to define the location, name and stability of your files (of course
414
            changing "yourname" and "friend" to suit your needs).
415
416
            If it uses more than one JAR, describe where they are located, how
417
            they refer to each other.
418
            If it consist of module JAR(s) and other files, please describe
419
            what is their purpose, why other files are necessary. Please
420
            make sure that installation/uninstallation leaves the system
421
            in state as it was before installation.
422
            </hint>
423
        </question>
424
-->
425
    <answer id="deploy-jar">
426
        <p>
427
            Just module JAR.
428
        </p>
429
    </answer>
430
431
432
433
<!--
434
        <question id="deploy-nbm" when="impl">
435
            Can you deploy an NBM via the Update Center?
436
            <hint>
437
            If not why?
438
            </hint>
439
        </question>
440
-->
441
    <answer id="deploy-nbm">
442
        <p>
443
            Yes.
444
        </p>
445
    </answer>
446
447
448
449
<!--
450
        <question id="deploy-packages" when="init">
451
            Are packages of your module made inaccessible by not declaring them
452
            public?
453
454
            <hint>
455
            By default NetBeans build harness treats all packages are private.
456
            If you export some of them - either as public or friend packages,
457
            you should have a reason. If the reason is described elsewhere
458
            in this document, you can ignore this question.
459
            </hint>
460
        </question>
461
-->
462
    <answer id="deploy-packages">
463
        <p>
464
            There is only public SPI, no private packages.
465
        </p>
466
    </answer>
467
468
469
470
<!--
471
        <question id="deploy-shared" when="final">
472
            Do you need to be installed in the shared location only, or in the user directory only,
473
            or can your module be installed anywhere?
474
            <hint>
475
            Installation location shall not matter, if it does explain why.
476
            Consider also whether <code>InstalledFileLocator</code> can help.
477
            </hint>
478
        </question>
479
-->
480
    <answer id="deploy-shared">
481
        <p>
482
            Location does not matter.
483
        </p>
484
    </answer>
485
486
487
488
<!--
489
        <question id="exec-ant-tasks" when="impl">
490
            Do you define or register any ant tasks that other can use?
491
492
            <hint>
493
            If you provide an ant task that users can use, you need to be very
494
            careful about its syntax and behaviour, as it most likely forms an
495
	          API for end users and as there is a lot of end users, their reaction
496
            when such API gets broken can be pretty strong.
497
            </hint>
498
        </question>
499
-->
500
    <answer id="exec-ant-tasks">
501
        <p>
502
            No.
503
        </p>
504
    </answer>
505
506
507
508
<!--
509
        <question id="exec-classloader" when="impl">
510
            Does your code create its own class loader(s)?
511
            <hint>
512
            A bit unusual. Please explain why and what for.
513
            </hint>
514
        </question>
515
-->
516
    <answer id="exec-classloader">
517
        <p>
518
            No.
519
        </p>
520
    </answer>
521
522
523
524
<!--
525
        <question id="exec-component" when="impl">
526
            Is execution of your code influenced by any (string) property
527
            of any of your components?
528
529
            <hint>
530
            Often <code>JComponent.getClientProperty</code>, <code>Action.getValue</code>
531
            or <code>PropertyDescriptor.getValue</code>, etc. are used to influence
532
            a behavior of some code. This of course forms an interface that should
533
            be documented. Also if one depends on some interface that an object
534
            implements (<code>component instanceof Runnable</code>) that forms an
535
            API as well.
536
            </hint>
537
        </question>
538
-->
539
    <answer id="exec-component">
540
        <p>
541
            No.
542
        </p>
543
    </answer>
544
545
546
547
<!--
548
        <question id="exec-introspection" when="impl">
549
            Does your module use any kind of runtime type information (<code>instanceof</code>,
550
            work with <code>java.lang.Class</code>, etc.)?
551
            <hint>
552
            Check for cases when you have an object of type A and you also
553
            expect it to (possibly) be of type B and do some special action. That
554
            should be documented. The same applies on operations in meta-level
555
            (Class.isInstance(...), Class.isAssignableFrom(...), etc.).
556
            </hint>
557
        </question>
558
-->
559
    <answer id="exec-introspection">
560
        <p>
561
            No.
562
        </p>
563
    </answer>
564
565
566
567
<!--
568
        <question id="exec-privateaccess" when="final">
569
            Are you aware of any other parts of the system calling some of
570
            your methods by reflection?
571
            <hint>
572
            If so, describe the "contract" as an API. Likely private or friend one, but
573
            still API and consider rewrite of it.
574
            </hint>
575
        </question>
576
-->
577
    <answer id="exec-privateaccess">
578
        <p>
579
            No.
580
        </p>
581
    </answer>
582
583
584
585
<!--
586
        <question id="exec-process" when="impl">
587
            Do you execute an external process from your module? How do you ensure
588
            that the result is the same on different platforms? Do you parse output?
589
            Do you depend on result code?
590
            <hint>
591
            If you feed an input, parse the output please declare that as an API.
592
            </hint>
593
        </question>
594
-->
595
    <answer id="exec-process">
596
        <p>
597
            No.
598
        </p>
599
    </answer>
600
601
602
603
<!--
604
        <question id="exec-property" when="impl">
605
            Is execution of your code influenced by any environment or
606
            Java system (<code>System.getProperty</code>) property?
607
            On a similar note, is there something interesting that you
608
            pass to <code>java.util.logging.Logger</code>? Or do you observe
609
            what others log?
610
            <hint>
611
            If there is a property that can change the behavior of your
612
            code, somebody will likely use it. You should describe what it does
613
            and the <a href="http://wiki.netbeans.org/API_Stability">stability category</a>
614
            of this API. You may use
615
            <pre>
616
                &lt;api type="export" group="property" name="id" category="private" url="http://..."&gt;
617
                    description of the property, where it is used, what it influence, etc.
618
                &lt;/api&gt;
619
            </pre>
620
            </hint>
621
        </question>
622
-->
623
    <answer id="exec-property">
624
        <p>
625
            No/No.
626
        </p>
627
    </answer>
628
629
630
631
<!--
632
        <question id="exec-reflection" when="impl">
633
            Does your code use Java Reflection to execute other code?
634
            <hint>
635
            This usually indicates a missing or insufficient API in the other
636
            part of the system. If the other side is not aware of your dependency
637
            this contract can be easily broken.
638
            </hint>
639
        </question>
640
-->
641
    <answer id="exec-reflection">
642
        <p>
643
            No.
644
        </p>
645
    </answer>
646
647
648
649
<!--
650
        <question id="exec-threading" when="init">
651
            What threading models, if any, does your module adhere to? How the
652
            project behaves with respect to threading?
653
            <hint>
654
                Is your API threadsafe? Can it be accessed from any threads or
655
                just from some dedicated ones? Any special relation to AWT and
656
                its Event Dispatch thread? Also
657
                if your module calls foreign APIs which have a specific threading model,
658
                indicate how you comply with the requirements for multithreaded access
659
                (synchronization, mutexes, etc.) applicable to those APIs.
660
                If your module defines any APIs, or has complex internal structures
661
                that might be used from multiple threads, declare how you protect
662
                data against concurrent access, race conditions, deadlocks, etc.,
663
                and whether such rules are enforced by runtime warnings, errors, assertions, etc.
664
                Examples: a class might be non-thread-safe (like Java Collections); might
665
                be fully thread-safe (internal locking); might require access through a mutex
666
                (and may or may not automatically acquire that mutex on behalf of a client method);
667
                might be able to run only in the event queue; etc.
668
                Also describe when any events are fired: synchronously, asynchronously, etc.
669
                Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations">Threading Recommendations</a> (in progress)
670
            </hint>
671
        </question>
672
-->
673
    <answer id="exec-threading">
674
        <p>
675
            The API is threadsafe. Mainly because it is very simple.
676
        </p>
677
    </answer>
678
679
680
681
<!--
682
        <question id="format-clipboard" when="impl">
683
            Which data flavors (if any) does your code read from or insert to
684
            the clipboard (by access to clipboard on means calling methods on <code>java.awt.datatransfer.Transferable</code>?
685
686
            <hint>
687
            Often Node's deal with clipboard by usage of <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
688
            Check your code for overriding these methods.
689
            </hint>
690
        </question>
691
-->
692
    <answer id="format-clipboard">
693
        <p>
694
            There is no interaction with the clipboard.
695
        </p>
696
    </answer>
697
698
699
700
<!--
701
        <question id="format-dnd" when="impl">
702
            Which protocols (if any) does your code understand during Drag &amp; Drop?
703
            <hint>
704
            Often Node's deal with clipboard by usage of <code>Node.drag, Node.getDropType</code>.
705
            Check your code for overriding these methods. Btw. if they are not overridden, they
706
            by default delegate to <code>Node.clipboardCopy, Node.clipboardCut and Node.pasteTypes</code>.
707
            </hint>
708
        </question>
709
-->
710
    <answer id="format-dnd">
711
        <p>
712
            No Drag &amp; Drop support.
713
        </p>
714
    </answer>
715
716
717
718
<!--
719
        <question id="format-types" when="impl">
720
            Which protocols and file formats (if any) does your module read or write on disk,
721
            or transmit or receive over the network? Do you generate an ant build script?
722
            Can it be edited and modified?
723
724
            <hint>
725
            <p>
726
            Files can be read and written by other programs, modules and users. If they influence
727
            your behaviour, make sure you either document the format or claim that it is a private
728
            api (using the &lt;api&gt; tag).
729
            </p>
730
731
            <p>
732
            If you generate an ant build file, this is very likely going to be seen by end users and
733
            they will be attempted to edit it. You should be ready for that and provide here a link
734
            to documentation that you have for such purposes and also describe how you are going to
735
            understand such files during next release, when you (very likely) slightly change the
736
            format.
737
            </p>
738
            </hint>
739
        </question>
740
-->
741
    <answer id="format-types">
742
        <p>
743
            No I/O is performed.
744
        </p>
745
    </answer>
746
747
748
749
<!--
750
        <question id="lookup-lookup" when="init">
751
            Does your module use <code>org.openide.util.Lookup</code>
752
            or any similar technology to find any components to communicate with? Which ones?
753
754
            <hint>
755
            NetBeans is build around a generic registry of services called
756
            lookup. It is preferable to use it for registration and discovery
757
            if possible. See
758
            <a href="http://www.netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/lookup/doc-files/index.html">
759
            The Solution to Comunication Between Components
760
            </a>. If you do not plan to use lookup and insist usage
761
            of other solution, then please describe why it is not working for
762
            you.
763
            <br/>
764
            When filling the final version of your arch document, please
765
            describe the interfaces you are searching for, where
766
            are defined, whether you are searching for just one or more of them,
767
            if the order is important, etc. Also classify the stability of such
768
            API contract. Use &lt;api group=&amp;lookup&amp; /&gt; tag, so
769
            your information gets listed in the summary page of your javadoc.
770
            </hint>
771
        </question>
772
-->
773
    <answer id="lookup-lookup">
774
        <p>
775
            No.
776
        </p>
777
    </answer>
778
779
780
781
<!--
782
        <question id="lookup-register" when="final">
783
            Do you register anything into lookup for other code to find?
784
            <hint>
785
            Do you register using layer file or using a declarative annotation such as <code>@ServiceProvider</code>?
786
            Who is supposed to find your component?
787
            </hint>
788
        </question>
789
-->
790
    <answer id="lookup-register">
791
        <p>
792
            No.
793
        </p>
794
    </answer>
795
796
797
798
<!--
799
        <question id="lookup-remove" when="final">
800
            Do you remove entries of other modules from lookup?
801
            <hint>
802
            Why? Of course, that is possible, but it can be dangerous. Is the module
803
            your are masking resource from aware of what you are doing?
804
            </hint>
805
        </question>
806
-->
807
    <answer id="lookup-remove">
808
        <p>
809
            No.
810
        </p>
811
    </answer>
812
813
814
815
<!--
816
        <question id="perf-exit" when="final">
817
            Does your module run any code on exit?
818
        </question>
819
-->
820
    <answer id="perf-exit">
821
        <p>
822
            No.
823
        </p>
824
    </answer>
825
826
827
828
<!--
829
        <question id="perf-huge_dialogs" when="final">
830
            Does your module contain any dialogs or wizards with a large number of
831
            GUI controls such as combo boxes, lists, trees, or text areas?
832
        </question>
833
-->
834
    <answer id="perf-huge_dialogs">
835
        <p>
836
            No.
837
        </p>
838
    </answer>
839
840
841
842
<!--
843
        <question id="perf-limit" when="init">
844
            Are there any hard-coded or practical limits in the number or size of
845
            elements your code can handle?
846
            <hint>
847
                Most of algorithms have increasing memory and speed complexity
848
                with respect to size of data they operate on. What is the critical
849
                part of your project that can be seen as a bottleneck with
850
                respect to speed or required memory? What are the practical
851
                sizes of data you tested your project with? What is your estimate
852
                of potential size of data that would cause visible performance
853
                problems? Is there some kind of check to detect such situation
854
                and prevent "hard" crashes - for example the CloneableEditorSupport
855
                checks for size of a file to be opened in editor
856
                and if it is larger than 1Mb it shows a dialog giving the
857
                user the right to decide - e.g. to cancel or commit suicide.
858
            </hint>
859
        </question>
860
-->
861
    <answer id="perf-limit">
862
        <p>
863
            No.
864
        </p>
865
    </answer>
866
867
868
869
<!--
870
        <question id="perf-mem" when="final">
871
            How much memory does your component consume? Estimate
872
            with a relation to the number of windows, etc.
873
        </question>
874
-->
875
    <answer id="perf-mem">
876
        <p>
877
            Memory consumption is very low.
878
        </p>
879
    </answer>
880
881
882
883
<!--
884
        <question id="perf-menus" when="final">
885
            Does your module use dynamically updated context menus, or
886
            context-sensitive actions with complicated and slow enablement logic?
887
            <hint>
888
                If you do a lot of tricks when adding actions to regular or context menus, you can significantly
889
                slow down display of the menu, even when the user is not using your action. Pay attention to
890
                actions you add to the main menu bar, and to context menus of foreign nodes or components. If
891
                the action is conditionally enabled, or changes its display dynamically, you need to check the
892
                impact on performance. In some cases it may be more appropriate to make a simple action that is
893
                always enabled but does more detailed checks in a dialog if it is actually run.
894
            </hint>
895
        </question>
896
-->
897
    <answer id="perf-menus">
898
        <p>
899
            No.
900
        </p>
901
    </answer>
902
903
904
905
<!--
906
        <question id="perf-progress" when="final">
907
            Does your module execute any long-running tasks?
908
909
            <hint>Long running tasks should never block
910
            AWT thread as it badly hurts the UI
911
            <a href="http://performance.netbeans.org/responsiveness/issues.html">
912
            responsiveness</a>.
913
            Tasks like connecting over
914
            network, computing huge amount of data, compilation
915
            be done asynchronously (for example
916
            using <code>RequestProcessor</code>), definitively it should
917
            not block AWT thread.
918
            </hint>
919
        </question>
920
-->
921
    <answer id="perf-progress">
922
        <p>
923
            No.
924
        </p>
925
    </answer>
926
927
928
929
<!--
930
        <question id="perf-scale" when="init">
931
            Which external criteria influence the performance of your
932
            program (size of file in editor, number of files in menu,
933
            in source directory, etc.) and how well your code scales?
934
            <hint>
935
            Please include some estimates, there are other more detailed
936
            questions to answer in later phases of implementation.
937
            </hint>
938
        </question>
939
-->
940
    <answer id="perf-scale">
941
        <p>
942
            There is almost no computation that could be influenced. The code
943
            is very simple.
944
        </p>
945
    </answer>
946
947
948
949
<!--
950
        <question id="perf-spi" when="init">
951
            How the performance of the plugged in code will be enforced?
952
            <hint>
953
            If you allow foreign code to be plugged into your own module, how
954
            do you enforce that it will behave correctly and quickly and will not
955
            negatively influence the performance of your own module?
956
            </hint>
957
        </question>
958
-->
959
    <answer id="perf-spi">
960
        <p>
961
            Implementations of
962
            <code>OpenFileDialogFilter</code> are usually very simple. They woud
963
            have to be implemented really very badly to influence the overall
964
            performance.
965
        </p>
966
    </answer>
967
968
969
970
<!--
971
        <question id="perf-startup" when="final">
972
            Does your module run any code on startup?
973
        </question>
974
-->
975
    <answer id="perf-startup">
976
        <p>
977
            No.
978
        </p>
979
    </answer>
980
981
982
983
<!--
984
        <question id="perf-wakeup" when="final">
985
            Does any piece of your code wake up periodically and do something
986
            even when the system is otherwise idle (no user interaction)?
987
        </question>
988
-->
989
    <answer id="perf-wakeup">
990
        <p>
991
            No.
992
        </p>
993
    </answer>
994
995
996
997
<!--
998
        <question id="resources-file" when="final">
999
            Does your module use <code>java.io.File</code> directly?
1000
1001
            <hint>
1002
            NetBeans provide a logical wrapper over plain files called
1003
            <code>org.openide.filesystems.FileObject</code> that
1004
            provides uniform access to such resources and is the preferred
1005
            way that should be used. But of course there can be situations when
1006
            this is not suitable.
1007
            </hint>
1008
        </question>
1009
-->
1010
    <answer id="resources-file">
1011
        <p>
1012
            No.
1013
        </p>
1014
    </answer>
1015
1016
1017
1018
<!--
1019
        <question id="resources-layer" when="final">
1020
            Does your module provide own layer? Does it create any files or
1021
            folders in it? What it is trying to communicate by that and with which
1022
            components?
1023
1024
            <hint>
1025
            NetBeans allows automatic and declarative installation of resources
1026
            by module layers. Module register files into appropriate places
1027
            and other components use that information to perform their task
1028
            (build menu, toolbar, window layout, list of templates, set of
1029
            options, etc.).
1030
            </hint>
1031
        </question>
1032
-->
1033
    <answer id="resources-layer">
1034
        <p>
1035
            No.
1036
        </p>
1037
    </answer>
1038
1039
1040
1041
<!--
1042
        <question id="resources-mask" when="final">
1043
            Does your module mask/hide/override any resources provided by other modules in
1044
            their layers?
1045
1046
            <hint>
1047
            If you mask a file provided by another module, you probably depend
1048
            on that and do not want the other module to (for example) change
1049
            the file's name. That module shall thus make that file available as an API
1050
            of some stability category.
1051
            </hint>
1052
        </question>
1053
-->
1054
    <answer id="resources-mask">
1055
        <p>
1056
            No.
1057
        </p>
1058
    </answer>
1059
1060
1061
1062
<!--
1063
        <question id="resources-preferences" when="final">
1064
            Does your module uses preferences via Preferences API? Does your module use NbPreferences or
1065
            or regular JDK Preferences ? Does it read, write or both?
1066
            Does it share preferences with other modules ? If so, then why ?
1067
            <hint>
1068
                You may use
1069
                    &lt;api type="export" group="preferences"
1070
                    name="preference node name" category="private"&gt;
1071
                    description of individual keys, where it is used, what it
1072
                    influences, whether the module reads/write it, etc.
1073
                    &lt;/api&gt;
1074
                Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
1075
                Note that if you use NbPreferences this name will then be the same as the code name base of the module.
1076
            </hint>
1077
        </question>
1078
-->
1079
    <answer id="resources-preferences">
1080
        <p>
1081
            No preferences are read/written/shared.
1082
        </p>
1083
    </answer>
1084
1085
1086
1087
<!--
1088
        <question id="resources-read" when="final">
1089
            Does your module read any resources from layers? For what purpose?
1090
1091
            <hint>
1092
            As this is some kind of intermodule dependency, it is a kind of API.
1093
            Please describe it and classify according to
1094
            <a href="http://wiki.netbeans.org/API_Design#What_is_an_API.3F">
1095
            common stability categories</a>.
1096
            </hint>
1097
        </question>
1098
-->
1099
    <answer id="resources-read">
1100
        <p>
1101
            No.
1102
        </p>
1103
    </answer>
1104
1105
1106
1107
<!--
1108
        <question id="security-grant" when="final">
1109
            Does your code grant additional rights to some other code?
1110
            <hint>Avoid using a class loader that adds extra
1111
            permissions to loaded code unless really necessary.
1112
            Also note that your API implementation
1113
            can also expose unneeded permissions to enemy code by
1114
            calling AccessController.doPrivileged().</hint>
1115
        </question>
1116
-->
1117
    <answer id="security-grant">
1118
        <p>
1119
            No.
1120
        </p>
1121
    </answer>
1122
1123
1124
1125
<!--
1126
        <question id="security-policy" when="final">
1127
            Does your functionality require modifications to the standard policy file?
1128
            <hint>Your code might pass control to third-party code not
1129
            coming from trusted domains. This could be code downloaded over the
1130
            network or code coming from libraries that are not bundled
1131
            with NetBeans. Which permissions need to be granted to which domains?</hint>
1132
        </question>
1133
-->
1134
    <answer id="security-policy">
1135
        <p>
1136
            No.
1137
        </p>
1138
    </answer>
1139
1140
</api-answers>
(-)a/api.openfile/build.xml (+5 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project basedir="." default="netbeans" name="api.openfile">
3
    <description>Builds, tests, and runs the project org.netbeans.api.openfile</description>
4
    <import file="../nbbuild/templates/projectized.xml"/>
5
</project>
(-)a/api.openfile/manifest.mf (+5 lines)
Line 0 Link Here
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.openfile
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/openfile/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.0
5
(-)a/api.openfile/nbproject/project.properties (+4 lines)
Line 0 Link Here
1
is.autoload=true
2
javac.source=1.6
3
javac.compilerargs=-Xlint -Xlint:-serial
4
javadoc.arch=${basedir}/arch.xml
(-)a/api.openfile/nbproject/project.xml (+22 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.openfile</code-name-base>
7
            <module-dependencies/>
8
            <test-dependencies>
9
                <test-type>
10
                    <name>unit</name>
11
                    <test-dependency>
12
                        <code-name-base>org.netbeans.libs.junit4</code-name-base>
13
                        <compile-dependency/>
14
                    </test-dependency>
15
                </test-type>
16
            </test-dependencies>
17
            <public-packages>
18
                <package>org.netbeans.spi.openfile</package>
19
            </public-packages>
20
        </data>
21
    </configuration>
22
</project>
(-)a/api.openfile/src/org/netbeans/api/openfile/Bundle.properties (+1 lines)
Line 0 Link Here
1
OpenIDE-Module-Name=Open File API
(-)a/utilities/src/org/netbeans/modules/openfile/OpenFileDialogFilter.java (-12 / +11 lines)
Lines 40-46 Link Here
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
40
 * Portions Copyrighted 2010 Sun Microsystems, Inc.
41
 */
41
 */
42
42
43
package org.netbeans.modules.openfile;
43
package org.netbeans.spi.openfile;
44
44
45
import java.io.File;
45
import java.io.File;
46
import java.util.ArrayList;
46
import java.util.ArrayList;
Lines 49-58 Link Here
49
import javax.swing.filechooser.FileNameExtensionFilter;
49
import javax.swing.filechooser.FileNameExtensionFilter;
50
50
51
/**
51
/**
52
 * {@code OpenFileDialogFilter} is an abstract class used by {@link FileChooser}
52
 * {@code OpenFileDialogFilter} is an abstract class used by NetBeans file
53
 * for filtering the set of files shown to the user in the <i>Open</i> dialog -
53
 * chooser for filtering the set of files shown to the user in the <i>Open</i>
54
 * <br />
54
 * dialog - <br />
55
 * <b>Main Menu â–º File â–º Open File...</b>
55
 * <b>Main Menu &gt; File &gt; Open File...</b>
56
 * <p>
56
 * <p>
57
 * This class is designed to be used as an abstraction of the service provider
57
 * This class is designed to be used as an abstraction of the service provider
58
 * in the NetBeans modules that provide opening of the standalone files via the
58
 * in the NetBeans modules that provide opening of the standalone files via the
Lines 61-67 Link Here
61
 * dialog the module should declare a non-abstract successor of this class, and
61
 * dialog the module should declare a non-abstract successor of this class, and
62
 * annotate it as a service provider like this:
62
 * annotate it as a service provider like this:
63
 * <pre>
63
 * <pre>
64
 * &#x40;ServiceProvider(service=org.netbeans.modules.openfile.OpenFileDialogFilter.class)
64
 * &#x40;ServiceProvider(service=org.netbeans.spi.openfile.OpenFileDialogFilter.class)
65
 * public class AFileTypeFilter extends OpenFileDialogFilter {
65
 * public class AFileTypeFilter extends OpenFileDialogFilter {
66
 *     ...
66
 *     ...
67
 *     // implementation of the class
67
 *     // implementation of the class
Lines 103-109 Link Here
103
 *
103
 *
104
 * @see javax.swing.filechooser.FileFilter
104
 * @see javax.swing.filechooser.FileFilter
105
 * @see javax.swing.filechooser.FileNameExtensionFilter
105
 * @see javax.swing.filechooser.FileNameExtensionFilter
106
 * @see FileChooser
107
 * @see OpenFileDialogFilter.ExtensionFilter
106
 * @see OpenFileDialogFilter.ExtensionFilter
108
 *
107
 *
109
 * @author Victor G. Vasilyev <vvg@netbeans.org>
108
 * @author Victor G. Vasilyev <vvg@netbeans.org>
Lines 153-159 Link Here
153
     *
152
     *
154
     * @param fileName a file name
153
     * @param fileName a file name
155
     * @param suffix an extension from a collection obtained via the
154
     * @param suffix an extension from a collection obtained via the
156
     * {@link #getExtensions()} method.
155
     * {@link #getSuffixes()} method.
157
     *
156
     *
158
     * @return <code>true</code> if <code>fileName</code> matches with
157
     * @return <code>true</code> if <code>fileName</code> matches with
159
     *         <code>suffix</code>, otherwaise <code>true</code>.
158
     *         <code>suffix</code>, otherwaise <code>true</code>.
Lines 167-173 Link Here
167
     * the list of applicable file name suffixes associated with this filter.
166
     * the list of applicable file name suffixes associated with this filter.
168
     *
167
     *
169
     * <p>
168
     * <p>
170
     * Note, it is final method. To define the filter description 
169
     * Note, it is final method. To define the filter description
171
     * a successor class should override the method
170
     * a successor class should override the method
172
     * {@link #getDescriptionString() }. </p>
171
     * {@link #getDescriptionString() }. </p>
173
     * @return a description string of the file filter that will be visible in
172
     * @return a description string of the file filter that will be visible in
Lines 213-219 Link Here
213
212
214
    /**
213
    /**
215
     * Returns acceptable file name suffixes.
214
     * Returns acceptable file name suffixes.
216
     *   
215
     *
217
     * @return an array of the non-null strings that contains file name suffixes.
216
     * @return an array of the non-null strings that contains file name suffixes.
218
     */
217
     */
219
    public abstract String[] getSuffixes();
218
    public abstract String[] getSuffixes();
Lines 265-271 Link Here
265
264
266
        /**
265
        /**
267
         * Returns an instance of the {@link FileNameExtensionFilter } class.
266
         * Returns an instance of the {@link FileNameExtensionFilter } class.
268
         * 
267
         *
269
         * @return an initialized non-null instance of the
268
         * @return an initialized non-null instance of the
270
         * {@link FileNameExtensionFilter } class.
269
         * {@link FileNameExtensionFilter } class.
271
         */
270
         */
Lines 288-294 Link Here
288
287
289
        @Override
288
        @Override
290
        public String[] getSuffixes() {
289
        public String[] getSuffixes() {
291
            ArrayList<String> suffixList = new ArrayList();
290
            ArrayList<String> suffixList = new ArrayList<String>();
292
            for(String extension : getFilter().getExtensions()) {
291
            for(String extension : getFilter().getExtensions()) {
293
                suffixList.add(EXTENSION_SEPARATOR + extension);
292
                suffixList.add(EXTENSION_SEPARATOR + extension);
294
            }
293
            }
(-)a/api.openfile/test/unit/src/org/netbeans/spi/openfile/OpenFileDialogFilterTest.java (+111 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 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 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.spi.openfile;
43
44
import java.io.File;
45
import java.util.Arrays;
46
import java.util.List;
47
import static org.junit.Assert.*;
48
import org.junit.Test;
49
50
/**
51
 * Test default implementation of OpenFileDialogFilter.
52
 *
53
 * @author jhavlin
54
 */
55
public class OpenFileDialogFilterTest {
56
57
    private final OpenFileDialogFilter filter = new OpenFileDialogFilterImpl();
58
59
    public OpenFileDialogFilterTest() {
60
    }
61
62
    @Test
63
    public void testAccept() {
64
        assertTrue(filter.accept(new File("test.xyz")));
65
        assertTrue(filter.accept(new File("test.XYZ")));
66
        assertTrue(filter.accept(new File("test.uvw")));
67
        assertTrue(filter.accept(new File("test.UVW")));
68
        assertFalse(filter.accept(new File("test.java")));
69
    }
70
71
    @Test
72
    public void testCompareSuffixes() {
73
        assertTrue(filter.compareSuffixes("test.xml", ".xml"));
74
        assertTrue(filter.compareSuffixes("test.xml", ".XML"));
75
        assertTrue(filter.compareSuffixes("test.XML", ".xml"));
76
        assertFalse(filter.compareSuffixes("test.xml", ".html"));
77
    }
78
79
    @Test
80
    public void testGetDescription() {
81
        assertEquals(
82
                "Custom Example Files [.xyz, .uvw]",
83
                filter.getDescription());
84
    }
85
86
    @Test
87
    public void testGetDescriptionString() {
88
        assertEquals("Custom Example Files", filter.getDescriptionString());
89
    }
90
91
    @Test
92
    public void testGetSuffixes() {
93
        List<String> suffixes = Arrays.asList(filter.getSuffixes());
94
        assertEquals(2, suffixes.size());
95
        assertTrue(suffixes.contains(".xyz"));
96
        assertTrue(suffixes.contains(".uvw"));
97
    }
98
99
    public class OpenFileDialogFilterImpl extends OpenFileDialogFilter {
100
101
        @Override
102
        public String getDescriptionString() {
103
            return "Custom Example Files";
104
        }
105
106
        @Override
107
        public String[] getSuffixes() {
108
            return new String[]{".xyz", ".uvw"};
109
        }
110
    }
111
}
(-)a/java.source/nbproject/project.xml (+8 lines)
Lines 77-82 Link Here
77
                    </run-dependency>
77
                    </run-dependency>
78
                </dependency>
78
                </dependency>
79
                <dependency>
79
                <dependency>
80
                    <code-name-base>org.netbeans.api.openfile</code-name-base>
81
                    <build-prerequisite/>
82
                    <compile-dependency/>
83
                    <run-dependency>
84
                        <specification-version>1.0</specification-version>
85
                    </run-dependency>
86
                </dependency>
87
                <dependency>
80
                    <code-name-base>org.netbeans.api.progress</code-name-base>
88
                    <code-name-base>org.netbeans.api.progress</code-name-base>
81
                    <build-prerequisite/>
89
                    <build-prerequisite/>
82
                    <compile-dependency/>
90
                    <compile-dependency/>
(-)a/java.source/src/org/netbeans/modules/java/Bundle.properties (-1 / +4 lines)
Lines 68-71 Link Here
68
TP_ExecutableBadge=Contains main class.
68
TP_ExecutableBadge=Contains main class.
69
TXT_OpenClassFile= Open Class File
69
TXT_OpenClassFile= Open Class File
70
70
71
CTL_SourceTabCaption=&Source
71
CTL_SourceTabCaption=&Source
72
73
#Open File Dialog filter
74
OFDFD_Java=Java Files
(-)a/java.source/src/org/netbeans/modules/java/JavaOpenFileDialogFilter.java (+65 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 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 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java;
43
44
import org.netbeans.spi.openfile.OpenFileDialogFilter;
45
import org.openide.util.NbBundle;
46
import org.openide.util.lookup.ServiceProvider;
47
48
/**
49
 * Open File Dialog filter for Java files.
50
 *
51
 * @author jhavlin
52
 */
53
@ServiceProvider(service = OpenFileDialogFilter.class)
54
public class JavaOpenFileDialogFilter extends OpenFileDialogFilter {
55
56
    @Override
57
    public String getDescriptionString() {
58
        return NbBundle.getMessage(getClass(), "OFDFD_Java");           //NOI18N
59
    }
60
61
    @Override
62
    public String[] getSuffixes() {
63
        return new String[]{".java"};                                   //NOI18N
64
    }
65
}
(-)a/nbbuild/cluster.properties (+1 lines)
Lines 230-235 Link Here
230
nb.cluster.ide=\
230
nb.cluster.ide=\
231
        api.debugger,\
231
        api.debugger,\
232
        api.java.classpath,\
232
        api.java.classpath,\
233
        api.openfile,\
233
        api.xml,\
234
        api.xml,\
234
        bugtracking,\
235
        bugtracking,\
235
        bugtracking.bridge,\
236
        bugtracking.bridge,\
(-)a/utilities/nbproject/project.xml (+8 lines)
Lines 50-55 Link Here
50
            <code-name-base>org.netbeans.modules.utilities</code-name-base>
50
            <code-name-base>org.netbeans.modules.utilities</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.api.openfile</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <specification-version>1.0</specification-version>
58
                    </run-dependency>
59
                </dependency>
60
                <dependency>
53
                    <code-name-base>org.netbeans.modules.queries</code-name-base>
61
                    <code-name-base>org.netbeans.modules.queries</code-name-base>
54
                    <build-prerequisite/>
62
                    <build-prerequisite/>
55
                    <compile-dependency/>
63
                    <compile-dependency/>
(-)a/utilities/src/org/netbeans/modules/openfile/Bundle.properties (-1 lines)
Lines 41-47 Link Here
41
# made subject to such option by the copyright holder.
41
# made subject to such option by the copyright holder.
42
42
43
# OpenFileDialogFilter
43
# OpenFileDialogFilter
44
OFDFD_Java=Java Files
45
OFDFD_Txt=Text Files
44
OFDFD_Txt=Text Files
46
45
47
# OpenFileAction
46
# OpenFileAction
(-)a/utilities/src/org/netbeans/modules/openfile/FileChooser.java (-20 / +11 lines)
Lines 83-90 Link Here
83
     * @see javax.swing.JFileChooser
83
     * @see javax.swing.JFileChooser
84
     */
84
     */
85
    public void addChoosableFileFilters() {
85
    public void addChoosableFileFilters() {
86
        for (OpenFileDialogFilter f :
86
        // Add legacy filters
87
                    Lookup.getDefault().lookupAll(OpenFileDialogFilter.class)) {
87
        for (org.netbeans.modules.openfile.OpenFileDialogFilter f :
88
                Lookup.getDefault().lookupAll(
89
                org.netbeans.modules.openfile.OpenFileDialogFilter.class)) {
90
            addChoosableFileFilter(f);
91
        }
92
        for (org.netbeans.spi.openfile.OpenFileDialogFilter f :
93
                Lookup.getDefault().lookupAll(
94
                org.netbeans.spi.openfile.OpenFileDialogFilter.class)) {
88
            addChoosableFileFilter(f);
95
            addChoosableFileFilter(f);
89
        }
96
        }
90
    }
97
    }
Lines 130-154 Link Here
130
        }
137
        }
131
    }
138
    }
132
139
133
140
    @ServiceProvider(service = org.netbeans.spi.openfile.OpenFileDialogFilter.class)
134
    @ServiceProvider(service=org.netbeans.modules.openfile.OpenFileDialogFilter.class)
135
    public static class JavaFilesFilter extends OpenFileDialogFilter {
136
137
        @Override
138
        public String getDescriptionString() {
139
            return NbBundle.getMessage(getClass(), "OFDFD_Java"); // NOI18N
140
        }
141
142
        @Override
143
        public String[] getSuffixes() {
144
            return new String[] {".java"};
145
        }
146
147
    }
148
149
    @ServiceProvider(service=OpenFileDialogFilter.class)
150
    public static class TxtFileFilter
141
    public static class TxtFileFilter
151
            extends OpenFileDialogFilter.ExtensionFilter {
142
            extends org.netbeans.spi.openfile.OpenFileDialogFilter.ExtensionFilter {
152
143
153
        @Override
144
        @Override
154
        public FileNameExtensionFilter getFilter() {
145
        public FileNameExtensionFilter getFilter() {
(-)a/utilities/src/org/netbeans/modules/openfile/OpenFileDialogFilter.java (+6 lines)
Lines 107-113 Link Here
107
 * @see OpenFileDialogFilter.ExtensionFilter
107
 * @see OpenFileDialogFilter.ExtensionFilter
108
 *
108
 *
109
 * @author Victor G. Vasilyev <vvg@netbeans.org>
109
 * @author Victor G. Vasilyev <vvg@netbeans.org>
110
 *
111
 * @deprecated Use {@link org.netbeans.spi.openfile.OpenFileDialogFilter}.
110
 */
112
 */
113
@Deprecated
111
public abstract class OpenFileDialogFilter extends FileFilter {
114
public abstract class OpenFileDialogFilter extends FileFilter {
112
115
113
    /**
116
    /**
Lines 258-264 Link Here
258
     * @see OpenFileDialogFilter
261
     * @see OpenFileDialogFilter
259
     * @see FileNameExtensionFilter
262
     * @see FileNameExtensionFilter
260
     *
263
     *
264
     * @deprecated Use
265
     * {@link org.netbeans.spi.openfile.OpenFileDialogFilter.ExtensionFilter}.
261
     */
266
     */
267
    @Deprecated
262
    public static abstract class ExtensionFilter extends OpenFileDialogFilter {
268
    public static abstract class ExtensionFilter extends OpenFileDialogFilter {
263
269
264
        private static final char EXTENSION_SEPARATOR = '.';
270
        private static final char EXTENSION_SEPARATOR = '.';

Return to bug 209998