1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://www.netbeans.org/cddl-gplv2.html
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License file at
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the GPL Version 2 section of the License file that
accompanied this code. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
Contributor(s):
The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
Microsystems, Inc. All Rights Reserved.
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 2, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 2] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 2 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 2 code and therefore, elected the GPL
Version 2 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
-->
<!DOCTYPE api-answers PUBLIC "-//NetBeans//DTD Arch Answers//EN" "../nbbuild/antsrc/org/netbeans/nbbuild/Arch.dtd" [
<!ENTITY api-questions SYSTEM "../nbbuild/antsrc/org/netbeans/nbbuild/Arch-api-questions.xml">
]>
<api-answers
question-version="1.29"
author="dstrupl@netbeans.org"
>
&api-questions;
<!--
<question id="arch-what">
What is this project good for?
<hint>
Please provide here a few lines describing the project,
what problem it should solve, provide links to documentation,
specifications, etc.
</hint>
</question>
-->
<answer id="arch-what">
In summary, the <api name="LoadersAPI" group="java" type="export" category="official" url="@TOP@org/openide/loaders/doc-files/api.html" />
is responsible for scanning files in a directory on disk,
weeding out irrelevant files of no interest to the IDE,
and grouping the rest into logical chunks, or just determining
what type of data each represents. It does this scanning by asking each registered
data loader whether or not the given file(s) should be handled. The first
loader to recognize a file takes ownership of it, and creates a matching data object to represent it to the rest of the IDE.
</answer>
<answer id="arch-usecases" >
A lot of usecases is described <a href="@TOP@/org/openide/loaders/doc-files/api.html" >in the javadoc</a>. Here
is the list of some faqs:
<usecase id="script" name="Using Scripting and Templating Languages" >
<p>
Often many people require ability to create a "clever" template - e.g.
write piece of simple text and at the time of its
<a href="@TOP@/org/openide/loaders/DataObject.html#createFromTemplate(org.openide.loaders.DataFolder,%20java.lang.String,%20java.util.Map)">
processing
</a>
do some advanced changes to it using either
<a name="script">scripting or templating</a> languages.
</p>
<p>
This traditionally used to be a bit complicated task, however since
version 6.1 there are new interfaces
<api name="org.openide.loaders.CreateFromTemplateHandler" category="official" group="lookup" type="export"
url="@TOP@/org/openide/loaders/CreateFromTemplateHandler.html">
can be registered as a services in a lookup and it is reponsible
for handling the whole copy of the template file(s) to the destination
folder.
</api> and
<api name="org.openide.loaders.CreateFromTemplateAttributesProvider" category="official" group="lookup" type="export"
url="@TOP@/org/openide/loaders/CreateFromTemplateAttributesProvider.html">
can be registered as a services in a lookup and it is reponsible
for providing "hints" - e.g. map mapping strings to various objects.
</api> and these interfaces allow anyone to extend the behaviour during
creation of new files without writing new
<a href="@TOP@/org/openide/loaders/DataLoader.html">DataLoader</a> and co.
</p>
<p style="margin-left: 0.2in; margin-right: 0.2in; margin-top: 0.2in; margin-bottom: 0.2in; border: 1.00pt solid #9999cc; padding: 0.1in; color: #666699">
<b>Smart Templating Quick How-To</b>
<br/>
First of all create a file in your module layer located somewhere
under the <code>Templates/</code> folder. Make it a template by
adding <attr name="template" boolvalue="true"/>. Associate
this template with a scripting language, for example by
<attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>.
Now make sure that the scripting language integration is also available
by requesting a token in standard format, for freemarker just put
<code>OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker</code>
in your manifest. This tells the NetBeans module system that a
module providing integration with such scripting engine has to be
enabled. Now you can use regular script language tags inside of
your template file. When you write your <code>instantiate</code>
method in your wizard, you can create a Map<String,Object> and
fill it with parameters collected from your wizard and then pass it
to
<a href="@TOP@/org/openide/loaders/DataObject.html#createFromTemplate(org.openide.loaders.DataFolder,%20java.lang.String,%20java.util.Map)">
createFromTemplate(targetFolder, targetName, mapWithParameters)
</a>. This will invoke the scripting language and make the
<code>mapWithParameters</code> values available to it. Beyond this
there is few standard parameters predefined including <code>name</code>, <code>user</code>, <code>date</code>, <code>time</code>, etc.
and also additional parameters are collected from all registered
<a href="@TOP@/org/openide/loaders/CreateFromTemplateAttributesProvider.html">CreateFromTemplateAttributesProvider</a>s.
</p>
<p>
Moreover there is a built in support for scripting languages in
the standard NetBeans IDE. If a template is annotated with
<api name="javax.script.ScriptEngine" category="official" group="property" type="export">
a property that can be associated to templates that either should
return real instance of <code>ScriptEngine</code> interface or
a <code>String</code> name of the engine that is then used to
search for it in the <code>javax.script.ScriptEngineManager</code>.
Usually the <a href="http://freemarker.sourceforge.net/">freemarker</a> engine is the one that is
supported by the NetBeans IDE - if your module wants to use it
then include a token dependency <code>OpenIDE-Module-Needs: javax.script.ScriptEngine.freemarker</code>
in your manifest file (also accessible through project customizer GUI)
to indicate to the system that you need it.
</api>
then the scripting engine is then used to process the template and
generate the output file. While running the engine one can rely
on few predefined properties:
</p>
<ul>
<li><api name="name" category="stable" group="property" type="export"> contains the name of the <a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a> that is being created</api></li>
<li><api name="user" category="stable" group="property" type="export"> contains the name the user</api></li>
<li><api name="nameAndExt" category="stable" group="property" type="export"> contains the name and extension of the file that is being created</api></li>
<li><api name="date" category="stable" group="property" type="export"> contains <code>String</code> representing the current day like <code>23. 3. 2007</code></api></li>
<li><api name="time" category="stable" group="property" type="export"> contains <code>String</code> the current time like <code>17:18:30</code></api></li>
<li><api name="dateTime" category="stable" group="property" type="export"> contains <code>java.util.Date</code> representing current data and time like</api></li>
<li><api name="encoding" category="stable" group="property" type="export"> contains <code>String</code> the file encoding of the template instance</api></li>
</ul>
<p>
Other properties can indeed be provided by
<a href="@TOP@/org/openide/loaders/CreateFromTemplateAttributesProvider.html">CreateFromTemplateAttributesProvider</a>s.
After processing, the output is also sent to appropriate
<code>org.openide.text.IndentEngine</code> associated
with the mime type of the template, for formating.
</p>
</usecase>
<usecase id="add-action-to-folder" name="How to add action to folder's popup menu?" >
<api name="Loaders-folder-any-Actions" category="stable" group="layer" type="export" >
The actions that the default folder loader shows in its popup menu are read from
a layer folder <code>Loaders/folder/any/Actions</code>
so if any module wishes
to extend, hide or reorder some of them it can just register its actions there.</api>
As code like this does:
<pre>
<folder name="Loaders" >
<folder name="folder" >
<folder name="any" >
<folder name="Actions" >
<file name="org-mymodule-MyAction.instance" >
<attr name="instanceCreate" stringvalue="org.mymodule.MyAction" />
</file>
</folder>
</folder>
</folder>
</folder>
</pre>
As described in general <a href="@org-openide-actions@/org/openide/actions/doc-files/api.html#adv-install">
actions registration tutorial</a>.
<p/>
This functionality is available since version 5.0 of the loaders module. Please use
<code>OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0</code> in your
module dependencies.
<p>
In version 5.8 all the standard loaders were changed to read actions
from layer:
</p>
<ul>
<li><api name="Loaders-text-xml-Actions" category="stable" group="layer" type="export" >
The actions that the standard XML loader shows in its popup menu are read from
a layer folder <code>Loaders/text/xml/Actions</code></api></li>
<li><api name="Loaders-content-unknown-Actions" category="stable" group="layer" type="export" >
The actions that the loader for unrecognized files shows in its popup menu are read from
a layer folder <code>Loaders/content/unknown/Actions</code></api></li>
<li><api name="Loaders-application-x-nbsettings-Actions" category="stable" group="layer" type="export" >
The actions that the loader for instance and settings files shows in its popup menu are read from
a layer folder <code>Loaders/application/x-nbsettings/Actions</code></api></li>
</ul>
</usecase>
<usecase id="let-others-to-add-actions-to-loader" name="How to allow others to enhance actions of your loader?" >
If you want other modules to enhance or modify actions that are visible on
<code>DataObject</code>s produced by your <code>DataLoader</code> and you
are either using <code>DataNode</code> or its subclass, you can just override
<code>protected String actionsContext()</code> method to return non-null
location of context in layers from where to read the actions.
<p/>
The usual value should match <code>Loaders/mime/type/Actions</code> scheme,
for example java is using <code>Loaders/text/x-java/Actions</code>, but
the name can be arbitrary.
<p/>
This functionality is available since version 5.0 of the loaders module. Please use
<code>OpenIDE-Module-Module-Dependencies: org.openide.loaders > 5.0</code> in your
module dependencies.
</usecase>
</answer>
<!-- Question: compat-i18n
<question id="compat-i18n">
Is your module correctly internationalized?
</question>
-->
<answer id="compat-i18n">
Yes.
</answer>
<!-- Question: compat-standards
<question id="compat-standards">
Does the module implements or defines any standards? Is the
implementation exact or it deviates somehow?
</question>
-->
<answer id="compat-standards">
No.
</answer>
<!-- Question: compat-version
<question id="compat-version">
Does your module properly coexists with earlier and future
versions? Can you correctly read settings? Will future
versions be able to read settings?
<hint>
Very helpful for reading settings is to store version number
there, so future versions can decide whether how to read/convert
the settings and older versions can ignore the new ones.
</hint>
</question>
-->
<answer id="compat-version">
No answer
</answer>
<!-- Question: dep-jre
<question id="dep-jre">
Which version of JRE you need (1.2, 1.3, 1.4, etc.)?
</question>
-->
<answer id="dep-jre">
JRE 1.3.
</answer>
<!-- Question: dep-jrejdk
<question id="dep-jrejdk">
Do you require JDK or is JRE enough?
</question>
-->
<answer id="dep-jrejdk">
JRE is enough.
</answer>
<!-- Question: dep-nb
<question id="dep-nb">
What other NetBeans projects this one depends on?
</question>
-->
<answer id="dep-nb">
It depends on
<api name="FilesystemsAPI" type="import" url="@org-openide-filesystems@/org/openide/filesystems/doc-files/api.html" category="official" group="java" />,
<api name="LookupAPI" type="import" url="@org-openide-util@/org/openide/util/doc-files/api.html#lookup" category="official" group="java" />,
<api name="UtilitiesAPI" type="import" url="@org-openide-util@/org/openide/util/doc-files/api.html" category="official" group="java" />.
</answer>
<!-- Question: dep-non-nb
<question id="dep-non-nb">
What other non-NetBeans projects this one depends on?
<hint>
Some non-NetBeans projects are packaged as NetBeans modules
and
it is prefered to use this approach when more modules may
depend on such third-party library.
</hint>
</question>
-->
<answer id="dep-non-nb">
It does not depend on any external library.
</answer>
<!-- Question: dep-platform
<question id="dep-platform">
On which platforms your module run? Any? Does it run in the same
way?
</question>
-->
<answer id="dep-platform">
It runs on any platform.
</answer>
<!-- Question: deploy-jar
<question id="deploy-jar">
Do you deploy just module JAR file(s) or some other files?
</question>
-->
<answer id="deploy-jar">
Data Systems are integral part of openide.jar.
</answer>
<!-- Question: deploy-nbm
<question id="deploy-nbm">
Can you deploy NBM via AutoUpdate center?
</question>
-->
<answer id="deploy-nbm">
Yes. openide.jar can be deployed via AutoUpdate.
</answer>
<!-- Question: deploy-packages
<question id="deploy-packages">
Are packages of your module made inaccessible by not declaring them
public?
<hint>
NetBeans module system allows restriction of access rights to
public classes of your module from other modules. This prevents
unwanted dependencies of others on your code and should be used
public packages
</a>).
</hint>
</question>
-->
<answer id="deploy-packages">
No.
</answer>
<!-- Question: deploy-shared
<question id="deploy-shared">
Do you need to be installed in shared location or only in user directory?
</question>
-->
<answer id="deploy-shared">
openide.jar needs to be in the system directory.
</answer>
<!-- Question: exec-classloader
<question id="exec-classloader">
Does your code uses own classloader?
</question>
-->
<answer id="exec-classloader">
No.
</answer>
<!-- Question: exec-component
<question id="exec-component">
Is execution of your code influenced by (string) property
of any of your components?
</question>
-->
<answer id="exec-component">
The data system stores some of its vital information in file attributes. Those
attributes are accessible via calls to
org.openide.filesystems.FileObject.getAttribute(name)
org.openide.filesystems.FileObject.setAttribute(name, value)
They can also be stored in the module layer. Please see filesystems
for more information about this.
<api type="export" group="property" name="NetBeansAttrAssignedLoader" category="stable" >
Extended attribute for holding the class of the loader that should
be used to recognize a file object before the normal processing takes
place.
</api>
<api type="export" group="property" name="NetBeansAttrAssignedLoaderModule" category="private" >
Extended attribute which may be used in addition to EA_ASSIGNED_LOADER
which indicates the code name base of the module that installed that preferred
loader. If the indicated module is not installed, ignore the loader request.
See #13816.
</api>
<api type="export" group="property" name="template" category="stable" >
If set to Boolean.TRUE the file is recognized as template and
its instantiation is allowed.
</api>
<!-- TemplateWizard: -->
<api type="export" group="property" name="isRemoteAndSlow" category="friend">
If the file attribute <code>isRemoteAndSlow</code> is <code>true</code> on a folder,
the New File wizard will avoid asking for its children.
</api>
<api type="export" group="property" name="templateWizardURL" category="stable" >
Attribute that defines a template wizard description page (type <code>URL</code> to HTML).
</api>
<api type="export" group="property" name="templateWizardIterator" category="stable" >
Attribute that defines a custom template wizard iterator (type <code>TemplateWizard.Iterator</code>).
</api>
<!-- DataShadow: -->
<api type="export" group="property" name="originalFile" category="stable" >
Path to the target file in its filesystem (type <code>String</code>).
</api>
<api type="export" group="property" name="originalFileSystem" category="stable" >
System name of filesystem of target file (type <code>String</code>; default is same as that of shadow).
</api>
<api type="export" group="property" name="UseOwnName" category="private" >
if true, the DataShadow name is used instead of original's name,
affects DataShadows of filesystem roots only
</api>
<api type="export" group="property" name="simple" category="stable" >
templates and folders under <code>Templates/</code>
folder can be annotated with <attr name="simple" boolvalue="false"<
if they are supposed to be hidden in <em>Template Manager</em>.
If a folder is annotated with this attribute, it is also hidden
in standard <em>New File wizard</em>.
</api>
<!-- FolderOrder: -->
<api type="export" group="property" name="PartialOrders" category="stable" >
Read the list of intended partial orders from disk.
Each element is a string of the form <samp>a/b</samp> for <samp>a</samp>, <samp>b</samp> filenames
with extension, where <samp>a</samp> should come before <samp>b</samp>.
The value of the attribute must be of type <code>Boolean</code>; ignored unless <code>true</code>.
</api>
<!-- DataFolder: -->
<api type="export" group="property" name="OpenIDE-Folder-SortMode" category="private" >
Extended attribute for order of children. The values
are "F", "N", "C", "0" (type <code>String</code>).
</api>
<api type="export" group="property" name="OpenIDE-Folder-Order" category="private" >
Extended attribute for order of children - stores list
of file names separated by '/' (type <code>String</code>).
</api>
<!-- FolderChildren -->
<api type="export" group="systemproperty" name="org.openide.loaders.FolderChildren.delayedCreation" category="devel">
<p>
Since 7.25 the <code>DataFolder.getNodeDelegate()</code> tries to prevent
creation of <a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
in AWT dispatch thread. Rather it creates dummy node with name
derived from the name of the file and simplified content of lookup:
</p>
<ul>
<li><a href="@org-openide-filesystems@/org/openide/filesystems/FileObject.html">FileObject</a>
- the file that the node represents</li>
<li><a href="@org-openide-nodes@/org/openide/nodes/Node.html">Node</a>
- the node itself, but without any important properties</li>
<li><a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
- created on the fly, very <b>inefficient</b>, if requested from
AWT dispatch thread, it prints a warning. Consider using
just <a href="@org-openide-filesystems@/org/openide/filesystems/FileObject.html">FileObject</a>.</li>
</ul>
<p>
The creation of real node is scheduled to background and as soon as
the
<a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>
and its
<a href="@org-openide-nodes@/org/openide/nodes/Node.html">Node</a> are
ready, the initial dummy node is replaced by the real one.
</p>
<p>
This whole system is slightly incompatible and may complicate creation
of filtered views over the node hierarchy (one needs to be ready to
really dynamics changes). That is why it is possible to disable
the new <q>delayed</q> system by starting the system with
<code>-Dorg.openide.loaders.FolderChildren.delayedCreation=false</code>.
Use this property as a temporary fix for your problems, but consider
fixing your code to support the <q>delayed mode</q> in the future.
</p>
</api>
<!-- ConnectionSupport: -->
<api type="export" group="property" name="EA-OpenIDE-Connection" category="private" >
Extended attribute to store (ArrayList of Type and Node.Handle).
Used by Java synchronization feature at least; generally, <code>ConnectionCookie</code>.
</api>
<api type="export" group="property" name="DataFolder.Index.reorderable" category="friend">
If set to <code>Boolean.TRUE</code> on a folder not in the system filesystem, make its node reorderable.
</api>
<api type="import" group="property" name="expectedTime" category="friend" >
When the DataObject is moved to new location, we
we need to adjust the time to the new file object.
<a href="@org-openide-text@/org/openide/text/CloneableEditorSupport.html">CloneableEditorSupport</a>
exports special "expectedTime" property for this purpose. Tested
in <code>DataEditorSupportTest.testChangeFileWhileOpen</code>.
</api>
</answer>
<!-- Question: exec-property
<question id="exec-property">
Is execution of your code influenced by any environment of
system (<code>System.getProperty</code>) property?
</question>
-->
<answer id="exec-property">
<!-- XMLDataObject: -->
<api type="import" group="property" name="org.xml.sax.driver" category="private" >
This is a standard way to find a class of a SAX2 driver. See
<a href="http://www.saxproject.org/"> SAX2 documentation </a>
</api>
<api type="import" group="property" name="netbeans.profile.memory" category="private" >
Boolean.TRUE means to dettach from shared impl of parser, it is static!?
</api>
<api type="export" group="systemproperty" name="org.openide.loaders.FolderList.refresh.interval" category="private" >
The value of type integer determines the number of milliseconds
between successive refreshes of contents of a folder. Can be used to tweak
performance of folder refresh. Defaults to 10.
</api>
<api group="systemproperty" category="friend" name="netbeans.dataobject.insecure.operation" type="export" >
If set to <b>true</b>, the <code>DataObject.copy, move, createFromTemplate</code>
are executed in insecure way. That means that other threads can access the
products of such operation before it finishes. This is a friend contract
with projects, that need to do such strange things. Will be removed when they
fix it.
</api>
<api group="javax.swing.UIManager" category="devel" name="Nb.Explorer.Folder.icon" type="export" >
Icon or Image for closed folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Nb.Explorer.Folder.openedIcon" type="export" >
Icon or Image for opened folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Tree.openedIcon" type="export" >
Fallback Icon or Image for opened folder.
</api>
<api group="javax.swing.UIManager" category="devel" name="Tree.closedIcon" type="export" >
Fallback Icon or Image for folder.
</api>
<api group="property" category="stable" name="wizard.anything" type="export" >
When <a href="@TOP@/org/openide/loaders/TemplateWizard.html">TemplateWizard</a> invokes
<a href="@TOP@/org/openide/loaders/DataObject.html">DataObject</a>.createFromTemplate,
it passes as argument all its <a href="@org-openide-dialogs@/org/openide/WizardDescriptor.html#getProperties()">properties</a>
to it with prefix <code>wizard.</code>. That way they are available to
underlaying <a href="@TOP@/architecture-summary.html#script">scripting and templating
engines</a>.
</api>
</answer>
<!-- Question: format-clipboard
<question id="format-clipboard">
Which protocols your code reads/inserts when communicating with
clipboard?
</question>
-->
<answer id="format-clipboard">
We use following MIME type:
application/x-java-openide-dataobjectdnd;class=org.openide.loaders.DataObject;mask={0}
</answer>
<!-- Question: format-dnd
<question id="format-dnd">
Which protocols your code understands during drag-n-drop?
</question>
-->
<answer id="format-dnd">
We use following MIME type:
application/x-java-openide-dataobjectdnd;class=org.openide.loaders.DataObject;mask={0}
</answer>
<!-- Question: format-types
<question id="format-types">
Which file formats your code reads or writes on disk?
</question>
-->
<answer id="format-types">
Any file format.
</answer>
<!-- Question: lookup-lookup
<question id="lookup-lookup">
Does your module used <code>org.openide.util.Lookup</code>
to find any components to communicate to? Which ones?
</question>
-->
<answer id="lookup-lookup">
<ul>
<li>DataLoaderPool.class </li>
<li>ActionManager.class</li>
<li>(in XMLDataObject) Node.Cookie.class</li>
<li>RepositoryNodeFactory.class</li>
<li>ModuleInfo.class</li>
<li>ClassLoader.class</li>
</ul>
<p>
If there is no <code>DataLoaderPool</code> available in default
lookup, the fallback is to use a simple loader pool that contains
just the fixed <q>system</q> loaders, and any
<code>DataLoader</code>s that can be found in default lookup.
</p>
DataFolder.FolderNode.setName() looks for one instance of org.openide.loaders.FolderRenameHandler.
</answer>
<!-- Question: lookup-register
<question id="lookup-register">
Do you register anything into the lookup for other to find? Who are
the others?
</question>
-->
<answer id="lookup-register">
Registration of
<ul>
<li>DataLoaderPool.class</li>
<li>Environment.Provider.class</li>
<li>RepositoryNodeFactory.class</li>
</ul>
is done in core in META-INF/services.
</answer>
<!-- Question: lookup-remove
<question id="lookup-remove">
Are removing entries of other modules from the lookup? Why?
</question>
-->
<answer id="lookup-remove">
No.
</answer>
<!-- Question: perf-exit
<question id="perf-exit">
Does your module executes anything on exit?
</question>
-->
<answer id="perf-exit">
No.
</answer>
<!-- Question: perf-huge_dialogs
<question id="perf-huge_dialogs">
Does your module contain any dialogs or wizards with huge
amount of GUI controls like combo boxes, lists, trees, text
areas?
</question>
-->
<answer id="perf-huge_dialogs">
This module contains infrastructure for creating "New" functionality
wizards.
</answer>
<!-- Question: perf-limit
<question id="perf-limit">
Are there any limits in number/size of elements your code
can handle?
</question>
-->
<answer id="perf-limit">
No.
</answer>
<!-- Question: perf-mem
<question id="perf-mem">
What is the amount of memory your component occupies? Estimate
with a relaction to the number of windows, etc.
</question>
-->
<answer id="perf-mem">
Unknown.
</answer>
<!-- Question: perf-menus
<question id="perf-menus">
Does your module use dynamically changing context menus or
context sensitive actions with complicated logic for enable/disable?
</question>
-->
<answer id="perf-menus">
No.
</answer>
<!-- Question: perf-progress
<question id="perf-progress">
Does your module executes some long running task?
<hint>Typically they are tasks like connecting over
network, computing huge amount of data, compilation.
Such communication should be done asynchronously (for example
using <code>RequestProcessor</code>), definitively it should
not block AWT thread.
</hint>
</question>
-->
<answer id="perf-progress">
The module uses its own RequestProcessors to handle long running
tasks.
</answer>
<!-- Question: perf-scale
<question id="perf-scale">
Which external criteria influence the performance of your
program (size of file in editor, number of files in menu,
in source directory, etc.) and how well your code scales?
Please include some estimates.
</question>
-->
<answer id="perf-scale">
Performance of some operations
is lineary proportional to number of files in a given
folder times number of registered data loaders in
the pool.
</answer>
<!-- Question: perf-startup
<question id="perf-startup">
Does your module executes anything on startup?
</question>
-->
<answer id="perf-startup">
Yes. The list of loaders is read from the disk to memory.
</answer>
<!-- Question: perf-wakeup
<question id="perf-wakeup">
Is any piece of your code waking up periodically?
</question>
-->
<answer id="perf-wakeup">
No.
</answer>
<!-- Question: resources-file
<question id="resources-file">
Does your module use <code>java.io.File</code> directly?
<hint>
NetBeans provide a logical wrapper over plain files called
<code>org.openide.filesystems.FileObject</code> that
provides uniform access to such resources and is the prefered
way that should be used. But of course there can be situations when
this is not suitable.
</hint>
</question>
-->
<answer id="resources-file">
No.
</answer>
<!-- Question: resources-layer
<question id="resources-layer">
Does your module provide own layer? Does it create some files or
folders on it? What it is trying to communicate by that and with which
component?
<hint>
NetBeans allows automatic and declarative installation of resources
by module layers. Module register files into appropriate places
and other components use that information to perform their task
(build menu, toolbar, window layout, list of templates, set of
options, etc.).
</hint>
</question>
-->
<answer id="resources-layer">
<p>
<api name="Loaders-mime-type-Factories" group="layer" type="export" category="stable"
url="@TOP@/org/openide/loaders/doc-files/api.html#register"
>
Loaders are registered in the layer in folder <code>Loaders/mime/type/Factories</code>.
</api>
</p>
<p>
Yes, module creates the folders in layer <samp>org/netbeans/core/ui/resources/layer.xml</samp>
in <samp>core-ui.jar</samp>. The folders are instrumental to store information
about used templates.
<b>Provided folders: </b>
</p>
<ul>
<li>
<api name="PrivilegedTemplates" group="layer" type="export" category="devel">
A folder Privileged offers to other module possibility add own templates.
</api><p></p>
</li>
<li>
<api name="RecentTemplates" group="layer" type="export" category="private">
A folder Recent stores a set of recently used templates, it's not open to other module.
</api><p></p>
</li>
<li>
<api name="Menu" group="layer" type="export" category="stable"><p>
The main menu of the application is composed by reading <code>Menu/</code>
folder in the layer. A sub folder is treated as a sub menu.
Instances of individual files (usually <code>.instance</code>
or <code>.shadow</code>) may then represent <a href="@JDK@/javax/swing/Action.html">Action</a>
or <a href="@JDK@/javax/swing/JMenuItem.html">JMenuItem</a>
or <a href="@JDK@/javax/swing/JSeparator.html">JSeparator</a>.
</p>
<p>
Since version 7.44 one can attach <code>property-prefix</code> attribute
to every folder. Then all the file attributes are scanned and if some
of them start with the specified prefix they are placed a
<a href="@JDK@/javax/swing/JComponent.html#putClientProperty(java.lang.Object,%20java.lang.Object)">
client
properties</a> on the <a href="@JDK@/javax/swing/JMenu.html">JMenu</a>
instance (after stripping the prefix off).
</p>
</api><p></p>
</li>
</ul>
<p>
None of them is forced to found.
</p>
</answer>
<!-- Question: resources-mask
<question id="resources-mask">
Does your module read any resource provided by another one in
module layer? Why?
</question>
-->
<answer id="resources-mask">
No.
</answer>
<!-- Question: resources-read
<question id="resources-read">
Does your module read any resources from layers? For what purpose?
</question>
-->
<answer id="resources-read">
NewTemplateAction reads a list of templates from folders Privileged and Recent.
This list is exposed in a popup menu.
</answer>
<!--
<question id="arch-overall" when="init">
Describe the overall architecture.
<hint>
What will be API for
<a href="http://openide.netbeans.org/tutorial/api-design.html#design.apiandspi" shape="rect">
clients and what support API</a>?
What parts will be pluggable?
How will plug-ins be registered? Please use <code><api type="export"/></code>
to describe your general APIs and specify their
<a href="http://openide.netbeans.org/tutorial/api-design.html#category-private" shape="rect">
stability categories</a>.
If possible please provide simple diagrams.
</hint>
</question>
-->
<answer id="arch-overall">
<p>
This module provides API (read <a href="@TOP@org/openide/loaders/doc-files/api.html">more</a>)
that works on top of <a href="@org-openide-filesystems@/overview-summary.html">file objects</a>
and gives each file a logical behaviour - icon, name, operations, etc.
</p>
</answer>
<!--
<question id="arch-quality" when="init">
How will the <a href="http://www.netbeans.org/community/guidelines/q-evangelism.html" shape="rect">quality</a>
of your code be tested and
how are future regressions going to be prevented?
<hint>
What kind of testing do
you want to use? How much functionality, in which areas,
should be covered by the tests? How you find out that your
project was successful?
</hint>
</question>
-->
<answer id="arch-quality">
<p>
XXX no answer for arch-quality
</p>
</answer>
<!--
<question id="arch-time" when="init">
What are the time estimates of the work?
<hint>
Please express your estimates of how long the design, implementation,
stabilization are likely to last. How many people will be needed to
implement this and what is the expected milestone by which the work should be
ready?
</hint>
</question>
-->
<answer id="arch-time">
<p>
XXX no answer for arch-time
</p>
</answer>
<!--
<question id="arch-where" when="impl">
Where one can find sources for your module?
<hint>
Please provide link to the CVS web client at
http://www.netbeans.org/download/source_browse.html
or just use tag defaultanswer generate='here'
</hint>
</question>
-->
<answer id="arch-where">
<defaultanswer generate='here' />
</answer>
<!--
<question id="compat-deprecation" when="init">
How the introduction of your project influences functionality
provided by previous version of the product?
<hint>
If you are planning to deprecate/remove/change any existing APIs,
list them here accompanied with the reason explaining why you
are doing so.
</hint>
</question>
-->
<answer id="compat-deprecation">
<p>
XXX no answer for compat-deprecation
</p>
</answer>
<!--
<question id="deploy-dependencies" when="final">
What do other modules need to do to declare a dependency on this one,
in addition to or instead of the normal module dependency declaration
(e.g. tokens to require)?
<hint>
Provide a sample of the actual lines you would add to a module manifest
to declare a dependency, for example OpenIDE-Module-Requires: some.token.
If other modules should not depend on this module, or should just use a
simple regular module dependency, you can just answer "nothing". If you
intentionally expose a semistable API to clients using implementation
dependencies, you should mention that here (but there is no need to give
an example of usage).
</hint>
</question>
-->
<answer id="deploy-dependencies">
<p>
XXX no answer for deploy-dependencies
</p>
</answer>
<!--
<question id="exec-ant-tasks" when="impl">
Do you define or register any ant tasks that other can use?
<hint>
If you provide an ant task that users can use, you need to be very
careful about its syntax and behaviour, as it most likely forms an
API for end users and as there is a lot of end users, their reaction
when such API gets broken can be pretty strong.
</hint>
</question>
-->
<answer id="exec-ant-tasks">
<p>
XXX no answer for exec-ant-tasks
</p>
</answer>
<!--
<question id="exec-introspection" when="impl">
Does your module use any kind of runtime type information (<code>instanceof</code>,
work with <code>java.lang.Class</code>, etc.)?
<hint>
Check for cases when you have an object of type A and you also
expect it to (possibly) be of type B and do some special action. That
should be documented. The same applies on operations in meta-level
(Class.isInstance(...), Class.isAssignableFrom(...), etc.).
</hint>
</question>
-->
<answer id="exec-introspection">
<p>
<api name="sun.swing.plaf.synth.SynthIcon" category="private" group="java" type="import">
We use class sun.swing.plaf.synth.SynthIcon from Sun proprietary API to paint
native toolbar D&D handle for GTK L&F. If this class is not found there
is fallback code to paint handle.
</api>
</p>
</answer>
<!--
<question id="exec-privateaccess" when="final">
Are you aware of any other parts of the system calling some of
your methods by reflection?
<hint>
If so, describe the "contract" as an API. Likely private or friend one, but
still API and consider rewrite of it.
</hint>
</question>
-->
<answer id="exec-privateaccess">
<p>
XXX no answer for exec-privateaccess
</p>
</answer>
<!--
<question id="exec-process" when="impl">
Do you execute an external process from your module? How do you ensure
that the result is the same on different platforms? Do you parse output?
Do you depend on result code?
<hint>
If you feed an input, parse the output please declare that as an API.
</hint>
</question>
-->
<answer id="exec-process">
<p>
XXX no answer for exec-process
</p>
</answer>
<!--
<question id="exec-reflection" when="impl">
Does your code use Java Reflection to execute other code?
<hint>
This usually indicates a missing or insufficient API in the other
part of the system. If the other side is not aware of your dependency
this contract can be easily broken.
</hint>
</question>
-->
<answer id="exec-reflection">
<p>
XXX no answer for exec-reflection
</p>
</answer>
<!--
<question id="exec-threading" when="init">
What threading models, if any, does your module adhere to? How the
project behaves with respect to threading?
<hint>
Is your API threadsafe? Can it be accessed from any threads or
just from some dedicated ones? Any special relation to AWT and
its Event Dispatch thread? Also
if your module calls foreign APIs which have a specific threading model,
indicate how you comply with the requirements for multithreaded access
(synchronization, mutexes, etc.) applicable to those APIs.
If your module defines any APIs, or has complex internal structures
that might be used from multiple threads, declare how you protect
data against concurrent access, race conditions, deadlocks, etc.,
and whether such rules are enforced by runtime warnings, errors, assertions, etc.
Examples: a class might be non-thread-safe (like Java Collections); might
be fully thread-safe (internal locking); might require access through a mutex
(and may or may not automatically acquire that mutex on behalf of a client method);
might be able to run only in the event queue; etc.
Also describe when any events are fired: synchronously, asynchronously, etc.
Ideas: <a href="http://core.netbeans.org/proposals/threading/index.html#recommendations" shape="rect">Threading Recommendations</a> (in progress)
</hint>
</question>
-->
<answer id="exec-threading">
<p>
XXX no answer for exec-threading
</p>
</answer>
<!--
<question id="perf-spi" when="init">
How the performance of the plugged in code will be enforced?
<hint>
If you allow foreign code to be plugged into your own module, how
do you enforce that it will behave correctly and quickly and will not
negatively influence the performance of your own module?
</hint>
</question>
-->
<answer id="perf-spi">
<p>
XXX no answer for perf-spi
</p>
</answer>
<!--
<question id="resources-preferences" when="final">
Does your module uses preferences via Preferences API? Does your module use NbPreferences or
or regular JDK Preferences ? Does it read, write or both ?
Does it share preferences with other modules ? If so, then why ?
<hint>
You may use
<api type="export" group="preferences"
name="preference node name" category="private">
description of individual keys, where it is used, what it
influences, whether the module reads/write it, etc.
</api>
Due to XML ID restrictions, rather than /org/netbeans/modules/foo give the "name" as org.netbeans.modules.foo.
Note that if you use NbPreferences this name will then be the same as the code name base of the module.
</hint>
</question>
-->
<answer id="resources-preferences">
<p>
<api category="devel" group="preferences" name="org.openide.actions.FileSystemRefreshAction.manual" type="export">
If <code>NbPreferences.root().node("org/openide/actions/FileSystemRefreshAction").getBoolean("manual", false)</code>
returns true, then <a href="@TOP@/org/openide/actions/FileSystemRefreshAction.html">FileSystemRefreshAction</a>
is displayed in popup menu of folders.
</api>
</p>
</answer>
<!--
<question id="security-grant" when="final">
Does your code grant additional rights to some other code?
<hint>Avoid using a class loader that adds extra
permissions to loaded code unless really necessary.
Also note that your API implementation
can also expose unneeded permissions to enemy code by
calling AccessController.doPrivileged().</hint>
</question>
-->
<answer id="security-grant">
<p>
XXX no answer for security-grant
</p>
</answer>
<!--
<question id="security-policy" when="final">
Does your functionality require modifications to the standard policy file?
<hint>Your code might pass control to third-party code not
coming from trusted domains. This could be code downloaded over the
network or code coming from libraries that are not bundled
with NetBeans. Which permissions need to be granted to which domains?</hint>
</question>
-->
<answer id="security-policy">
<p>
XXX no answer for security-policy
</p>
</answer>
</api-answers>
|