You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ge...@apache.org on 2018/05/10 07:43:50 UTC
[incubator-netbeans] branch master updated: [NETBEANS-305] Remove
references to GPL/LGPL-21 licenses (#540)
This is an automated email from the ASF dual-hosted git repository.
geertjan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new a8b8588 [NETBEANS-305] Remove references to GPL/LGPL-21 licenses (#540)
a8b8588 is described below
commit a8b8588355fff2ad38aff7003616c274deb50c8a
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Thu May 10 09:43:44 2018 +0200
[NETBEANS-305] Remove references to GPL/LGPL-21 licenses (#540)
The GPL reference in apisupport.installer was used in the RCP installer
dialog as a choseable license. As the ALv2 source can't be linked with
GPLv2 code, the file was completely removed (GPLv3 would have been ok!).
The LGPL-21 license in nbbuild was referenced by the modules:
o.jdesktop.beansbinding
hibernate4lib
Both modules would be buildable by the apache netbeans project
(LGPL license) and were already removed from the cluster definition.
Dependend modules were also removed (form.binding and hibernate).
---
.../apisupport/installer/resources/licenses/GPL | 339 -----
.../apisupport/installer/ui/Bundle.properties | 2 -
form.binding/build.xml | 24 -
form.binding/manifest.mf | 7 -
form.binding/nbproject/project.properties | 21 -
form.binding/nbproject/project.xml | 141 --
.../form/binding/BindingDesignSupportImpl.java | 1543 -------------------
.../binding/BindingDesignSupportProviderImpl.java | 39 -
.../modules/form/binding/Bundle.properties | 21 -
.../binding/resources/BindingSystemClasses.txt | 17 -
.../form/binding/resources/Bundle.properties | 19 -
.../form/binding/resources/beans_binding.xml | 44 -
.../modules/form/binding/resources/layer.xml | 38 -
hibernate/build.xml | 32 -
hibernate/external/binaries-list | 17 -
.../hibernate-external-resources-license.txt | 502 -------
hibernate/licenseinfo.xml | 38 -
hibernate/manifest.mf | 5 -
hibernate/nbproject/project.properties | 41 -
hibernate/nbproject/project.xml | 521 -------
.../modules/hibernate/catalog/Bundle.properties | 19 -
.../hibernate/catalog/HibernateCatalog.java | 132 --
.../modules/hibernate/cfg/Bundle.properties | 19 -
.../hibernate/cfg/HibernateCfgProperties.java | 225 ---
.../hibernate/cfg/HibernateCfgXmlConstants.java | 41 -
.../modules/hibernate/cfg/model/package-info.java | 33 -
.../modules/hibernate/completion/Bundle.properties | 177 ---
.../hibernate/completion/CompletionContext.java | 301 ----
.../modules/hibernate/completion/Completor.java | 473 ------
.../completion/HibernateCfgCompletionManager.java | 275 ----
.../completion/HibernateCfgCompletionProvider.java | 50 -
.../completion/HibernateCfgCompletionQuery.java | 97 --
.../HibernateCompletionDocumentation.java | 98 --
.../completion/HibernateCompletionItem.java | 866 -----------
.../HibernateMappingCompletionManager.java | 276 ----
.../HibernateMappingCompletionProvider.java | 52 -
.../HibernateMappingCompletionQuery.java | 91 --
.../HibernateRevengCompletionManager.java | 197 ---
.../HibernateRevengCompletionProvider.java | 52 -
.../completion/HibernateRevengCompletionQuery.java | 91 --
.../completion/LazyTypeCompletionItem.java | 157 --
.../modules/hibernate/editor/Bundle.properties | 19 -
.../modules/hibernate/editor/ContextUtilities.java | 172 ---
.../modules/hibernate/editor/DocumentContext.java | 236 ---
.../hibernate/editor/EditorContextFactory.java | 42 -
.../hibernate/editor/HibernateEditorUtil.java | 251 ----
.../hibernate/hqleditor/HQLEditorController.java | 835 ----------
.../modules/hibernate/hqleditor/HQLExecutor.java | 71 -
.../modules/hibernate/hqleditor/HQLResult.java | 58 -
.../hibernate/hqleditor/ui/Bundle.properties | 53 -
.../hibernate/hqleditor/ui/HQLEditorAction.java | 60 -
.../hqleditor/ui/HQLEditorTopComponent.form | 426 ------
.../hqleditor/ui/HQLEditorTopComponent.java | 1013 -------------
.../hqleditor/ui/resources/queryEditor16X16.png | Bin 581 -> 0 bytes
.../hqleditor/ui/resources/run_hql_query_16.png | Bin 598 -> 0 bytes
.../modules/hibernate/hyperlink/Bundle.properties | 18 -
.../hyperlink/HibernateCfgHyperlinkProvider.java | 130 --
.../HibernateMappingHyperlinkProvider.java | 156 --
.../modules/hibernate/hyperlink/HyperlinkEnv.java | 136 --
.../hibernate/hyperlink/HyperlinkProcessor.java | 36 -
.../hyperlink/JavaClassHyperlinkProcessor.java | 47 -
.../hyperlink/PropertyHyperlinkProcessor.java | 95 --
.../hyperlink/ResourceHyperlinkProcessor.java | 68 -
.../loaders/HbXmlMultiViewEditorSupport.java | 62 -
.../hibernate/loaders/cfg/Bundle.properties | 49 -
.../loaders/cfg/HibernateCfgDataLoader.java | 62 -
.../cfg/HibernateCfgDataLoaderBeanInfo.java | 54 -
.../loaders/cfg/HibernateCfgDataNode.java | 49 -
.../loaders/cfg/HibernateCfgDataObject.java | 355 -----
.../loaders/cfg/HibernateCfgMetadata.java | 73 -
.../loaders/cfg/multiview/BrowseFolders.form | 71 -
.../loaders/cfg/multiview/BrowseFolders.java | 297 ----
.../loaders/cfg/multiview/Bundle.properties | 116 --
.../loaders/cfg/multiview/ClassCachePanel.form | 180 ---
.../loaders/cfg/multiview/ClassCachePanel.java | 204 ---
.../loaders/cfg/multiview/ClassCachesPanel.java | 86 --
.../cfg/multiview/ClassCachesTableModel.java | 121 --
.../cfg/multiview/ClassCachesTablePanel.java | 127 --
.../cfg/multiview/CollectionCachePanel.form | 178 ---
.../cfg/multiview/CollectionCachePanel.java | 181 ---
.../cfg/multiview/CollectionCachesPanel.java | 86 --
.../cfg/multiview/CollectionCachesTableModel.java | 119 --
.../cfg/multiview/CollectionCachesTablePanel.java | 122 --
.../loaders/cfg/multiview/EventListenerPanel.form | 98 --
.../loaders/cfg/multiview/EventListenerPanel.java | 136 --
.../loaders/cfg/multiview/EventPanel.java | 87 --
.../loaders/cfg/multiview/EventTableModel.java | 99 --
.../loaders/cfg/multiview/EventTablePanel.java | 120 --
.../loaders/cfg/multiview/GrantPanel.form | 158 --
.../loaders/cfg/multiview/GrantPanel.java | 156 --
.../cfg/multiview/HibernateCfgPanelFactory.java | 76 -
.../multiview/HibernateCfgToolBarMVElement.java | 269 ----
.../loaders/cfg/multiview/MappingPanel.form | 321 ----
.../loaders/cfg/multiview/MappingPanel.java | 318 ----
.../loaders/cfg/multiview/MappingsPanel.java | 85 --
.../loaders/cfg/multiview/MappingsTableModel.java | 126 --
.../loaders/cfg/multiview/MappingsTablePanel.java | 203 ---
.../loaders/cfg/multiview/NewEventPanel.form | 79 -
.../loaders/cfg/multiview/NewEventPanel.java | 103 --
.../loaders/cfg/multiview/PropertiesPanel.java | 81 -
.../cfg/multiview/PropertiesTableModel.java | 169 ---
.../cfg/multiview/PropertiesTablePanel.java | 164 --
.../loaders/cfg/multiview/PropertyPanel.form | 97 --
.../loaders/cfg/multiview/PropertyPanel.java | 206 ---
.../loaders/cfg/multiview/SecurityPanel.java | 85 --
.../loaders/cfg/multiview/SecurityTableModel.java | 128 --
.../loaders/cfg/multiview/SecurityTablePanel.java | 119 --
.../hibernate/loaders/cfg/multiview/Util.java | 142 --
.../hibernate/loaders/mapping/Bundle.properties | 19 -
.../mapping/HibernateMappingDataLoader.java | 61 -
.../HibernateMappingDataLoaderBeanInfo.java | 55 -
.../loaders/mapping/HibernateMappingDataNode.java | 51 -
.../mapping/HibernateMappingDataObject.java | 155 --
.../loaders/mapping/HibernateMappingMetadata.java | 75 -
.../hibernate/loaders/reveng/Bundle.properties | 17 -
.../loaders/reveng/HibernateRevengDataLoader.java | 60 -
.../reveng/HibernateRevengDataLoaderBeanInfo.java | 54 -
.../loaders/reveng/HibernateRevengDataNode.java | 55 -
.../loaders/reveng/HibernateRevengDataObject.java | 153 --
.../loaders/reveng/HibernateRevengMetadata.java | 74 -
.../mapping/HibernateMappingXmlConstants.java | 71 -
.../hibernate/mapping/model/package-info.java | 33 -
.../hibernate/refactoring/Bundle.properties | 37 -
.../refactoring/HibernateFindUsagesPlugin.java | 214 ---
.../HibernateMappingFindUsagesPlugin.java | 127 --
.../refactoring/HibernateMappingMovePlugin.java | 218 ---
...HibernateMappingRefactoringActionsProvider.java | 209 ---
.../refactoring/HibernateMappingRenamePlugin.java | 149 --
.../HibernateMappingRenameTransaction.java | 101 --
.../HibernateMappingWhereUsedQueryUI.java | 84 --
.../hibernate/refactoring/HibernateMovePlugin.java | 155 --
.../refactoring/HibernateRefactoringElement.java | 97 --
.../HibernateRefactoringPluginFactory.java | 74 -
.../refactoring/HibernateRefactoringUtil.java | 753 ----------
.../refactoring/HibernateRenamePlugin.java | 286 ----
.../HibernateRenameRefactoringElement.java | 61 -
.../refactoring/JavaClassRenameTransaction.java | 103 --
.../refactoring/JavaFieldRenameTransaction.java | 549 -------
.../refactoring/JavaPackageRenameTransaction.java | 108 --
.../hibernate/refactoring/JavaRenameChanger.java | 770 ----------
.../refactoring/MoveMappingFilePanel.form | 176 ---
.../refactoring/MoveMappingFilePanel.java | 360 -----
.../refactoring/MoveMappingFilesRefactoringUI.java | 223 ---
.../refactoring/RenameMappingFilePanel.form | 119 --
.../refactoring/RenameMappingFilePanel.java | 151 --
.../RenameMappingFileRefactoringUI.java | 121 --
.../hibernate/refactoring/RenameTransaction.java | 95 --
.../modules/hibernate/resources/Bundle.properties | 34 -
.../resources/HQLEditorTopComponentSettings.xml | 28 -
.../resources/HQLEditorTopComponentWstcref.xml | 28 -
.../hibernate/resources/HibernateCodeGenFile.html | 29 -
.../hibernate/resources/HibernateConfig.xml | 9 -
.../resources/HibernateConfigurationFile.html | 30 -
.../hibernate/resources/HibernateMapping.xml | 10 -
.../hibernate/resources/HibernateMappingFile.html | 29 -
.../hibernate/resources/HibernateReveng.xml | 10 -
.../hibernate/resources/HibernateRevengFile.html | 29 -
.../resources/HibernateRevengTemplate.xml | 2 -
.../hibernate/resources/HibernateUtil.javax | 37 -
.../hibernate/resources/HibernateUtilFile.html | 29 -
.../hibernate/resources/completion/column.gif | Bin 651 -> 0 bytes
.../resources/completion/columnForeign.gif | Bin 651 -> 0 bytes
.../hibernate/resources/completion/columnIndex.gif | Bin 919 -> 0 bytes
.../resources/completion/columnPrimary.gif | Bin 653 -> 0 bytes
.../hibernate/resources/completion/columnView.gif | Bin 918 -> 0 bytes
.../hibernate/resources/completion/table.gif | Bin 427 -> 0 bytes
.../resources/hibernate-configuration-3.0.mdd | 109 --
.../resources/hibernate-configuration.png | Bin 742 -> 0 bytes
.../hibernate/resources/hibernate-mapping-3.0.mdd | 1589 --------------------
.../hibernate/resources/hibernate-mapping.png | Bin 779 -> 0 bytes
.../hibernate/resources/hibernate-reveng.png | Bin 847 -> 0 bytes
.../hibernate-reverse-engineering-3.0.mdd | 151 --
.../modules/hibernate/resources/hql-language.nbs | 76 -
.../netbeans/modules/hibernate/resources/layer.xml | 382 -----
.../reveng/HibernateRevengXmlConstants.java | 45 -
.../hibernate/reveng/model/package-info.java | 33 -
.../modules/hibernate/service/TableColumn.java | 58 -
.../service/api/HibernateEnvironment.java | 211 ---
.../service/listener/ProjectOpenedHookImpl.java | 73 -
.../service/spi/HibernateEnvironmentImpl.java | 608 --------
.../spi/HibernateVerificationWarningOverrider.java | 62 -
.../hibernate/HibernateFileLocationProvider.java | 37 -
.../modules/hibernate/util/CustomClassLoader.java | 261 ----
.../util/CustomJDBCConnectionProvider.java | 189 ---
.../modules/hibernate/util/HibernateUtil.java | 766 ----------
.../modules/hibernate/wizards/Bundle.properties | 86 --
...ibernateCodGenNameLocationWizardDescriptor.java | 73 -
.../hibernate/wizards/HibernateCodeGenWizard.java | 461 ------
.../wizards/HibernateCodeGenWizardDescriptor.java | 283 ----
.../wizards/HibernateCodeGenWizardHelper.java | 137 --
.../wizards/HibernateCodeGenerationPanel.form | 276 ----
.../wizards/HibernateCodeGenerationPanel.java | 411 -----
.../wizards/HibernateConfigurationWizard.java | 301 ----
.../HibernateConfigurationWizardDescriptor.java | 120 --
.../wizards/HibernateConfigurationWizardPanel.form | 130 --
.../wizards/HibernateConfigurationWizardPanel.java | 239 ---
.../hibernate/wizards/HibernateMappingWizard.java | 295 ----
.../wizards/HibernateMappingWizardDescriptor.java | 103 --
.../wizards/HibernateMappingWizardPanel.form | 177 ---
.../wizards/HibernateMappingWizardPanel.java | 290 ----
.../HibernateRevengDatabaseTablesPanel.form | 320 ----
.../HibernateRevengDatabaseTablesPanel.java | 567 -------
.../HibernateRevengDbTablesWizardDescriptor.java | 165 --
.../hibernate/wizards/HibernateRevengWizard.java | 287 ----
.../netbeans/modules/hibernate/wizards/Util.java | 199 ---
.../hibernate/wizards/WizardErrorPanel.form | 66 -
.../hibernate/wizards/WizardErrorPanel.java | 108 --
.../hibernate/wizards/support/Bundle.properties | 70 -
.../wizards/support/DBSchemaFileList.java | 104 --
.../hibernate/wizards/support/DBSchemaManager.java | 350 -----
.../wizards/support/DBSchemaTableProvider.java | 251 ----
.../wizards/support/DBSchemaUISupport.java | 109 --
.../wizards/support/EmptyTableProvider.java | 34 -
.../hibernate/wizards/support/SelectedTables.java | 310 ----
.../wizards/support/SourceGroupUISupport.java | 57 -
.../modules/hibernate/wizards/support/Table.java | 160 --
.../hibernate/wizards/support/TableClosure.java | 397 -----
.../hibernate/wizards/support/TableProvider.java | 34 -
.../hibernate/wizards/support/TableSource.java | 74 -
.../hibernate/wizards/support/TableUISupport.java | 414 -----
.../HibernateCfgCompletionManagerTest.java | 163 --
.../completion/HibernateCompletionTestBase.java | 99 --
.../HibernateMappingCompletionManagerTest.java | 91 --
.../modules/hibernate/completion/Util.java | 53 -
.../hibernate/completion/resources/Person.hbm.xml | 36 -
.../completion/resources/hibernate.cfg.xml | 35 -
.../HibernateCfgHyperlinkProviderTest.java | 67 -
.../HibernateMappingHyperlinkProviderTest.java | 98 --
.../hibernate/hyperlink/resources/Person.hbm.xml | 36 -
.../hyperlink/resources/hibernate.cfg.xml | 35 -
.../mimeresolver/HibernateMIMEResolver.java | 57 -
hibernate4lib/build.xml | 25 -
hibernate4lib/external/binaries-list | 17 -
.../external/hibernate-4.3.1-lib-license.txt | 387 -----
hibernate4lib/manifest.mf | 5 -
hibernate4lib/nbproject/project.properties | 54 -
hibernate4lib/nbproject/project.xml | 124 --
.../modules/hibernate4lib/Bundle.properties | 21 -
.../hibernate4lib/resources/Bundle.properties | 21 -
.../resources/hibernate-persistence-modelgen.xml | 50 -
.../resources/hibernate-persistence.xml | 60 -
.../modules/hibernate4lib/resources/hibernate.xml | 59 -
.../hibernate4lib/resources/jpa2-persistence.xml | 42 -
.../modules/hibernate4lib/resources/layer.xml | 40 -
nbbuild/licenses/LGPL-2.1 | 460 ------
nbbuild/licenses/names.properties | 1 -
nbbuild/rat-exclusions.txt | 2 -
o.jdesktop.beansbinding/build.xml | 24 -
.../external/beansbinding-1.2.1-license.txt | 520 -------
o.jdesktop.beansbinding/external/binaries-list | 18 -
o.jdesktop.beansbinding/manifest.mf | 4 -
.../nbproject/project.properties | 22 -
o.jdesktop.beansbinding/nbproject/project.xml | 37 -
.../netbeans/libs/beansbinding/Bundle.properties | 21 -
254 files changed, 38741 deletions(-)
diff --git a/apisupport.installer/src/org/netbeans/modules/apisupport/installer/resources/licenses/GPL b/apisupport.installer/src/org/netbeans/modules/apisupport/installer/resources/licenses/GPL
deleted file mode 100644
index d511905..0000000
--- a/apisupport.installer/src/org/netbeans/modules/apisupport/installer/resources/licenses/GPL
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/Bundle.properties b/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/Bundle.properties
index 0a4fec9..696d2cf 100644
--- a/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/Bundle.properties
+++ b/apisupport.installer/src/org/netbeans/modules/apisupport/installer/ui/Bundle.properties
@@ -28,7 +28,6 @@ InstallerPanel_License.FileChooser.Title=Select License File...
SuiteInstallerProjectProperties.license.type.no=No License
SuiteInstallerProjectProperties.license.type.cddl=CDDL 1.0
-SuiteInstallerProjectProperties.license.type.gpl.v2=GPL v2
SuiteInstallerProjectProperties.license.type.cddl+gplv2=CDDL 1.0 + GPL v2 with ClassPath Exception
SuiteInstallerProjectProperties.license.type.apache.v2=Apache License Version 2.0
SuiteInstallerProjectProperties.license.type.custom=Select License File...
@@ -36,7 +35,6 @@ SuiteInstallerProjectProperties.license.type.custom=Select License File...
#SuiteInstallerProjectProperties.license.file.no=
SuiteInstallerProjectProperties.license.file.cddl=nbres:/org/netbeans/modules/apisupport/installer/resources/licenses/CDDL-1.0
-SuiteInstallerProjectProperties.license.file.gpl.v2=nbres:/org/netbeans/modules/apisupport/installer/resources/licenses/GPL
SuiteInstallerProjectProperties.license.file.cddl+gplv2=nbres:/org/netbeans/modules/apisupport/installer/resources/licenses/CDDL-GPL-2-CP
SuiteInstallerProjectProperties.license.file.apache.v2=nbres:/org/netbeans/modules/apisupport/installer/resources/licenses/Apache-2.0
InstallerPanel.pack200checkBox.text=Use pac&k200 compression
diff --git a/form.binding/build.xml b/form.binding/build.xml
deleted file mode 100644
index 64bc2a2..0000000
--- a/form.binding/build.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project basedir="." default="build" name="form.binding">
- <import file="../nbbuild/templates/projectized.xml"/>
-</project>
diff --git a/form.binding/manifest.mf b/form.binding/manifest.mf
deleted file mode 100644
index 0a199cd..0000000
--- a/form.binding/manifest.mf
+++ /dev/null
@@ -1,7 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: org.netbeans.modules.form.binding/0
-OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/form/binding/Bundle.properties
-OpenIDE-Module-Layer: org/netbeans/modules/form/binding/resources/layer.xml
-OpenIDE-Module-Implementation-Version: 1
-OpenIDE-Module-Provides: org.netbeans.modules.form.BindingDesignSupportProvider
-AutoUpdate-Show-In-Client: false
diff --git a/form.binding/nbproject/project.properties b/form.binding/nbproject/project.properties
deleted file mode 100644
index 9924871..0000000
--- a/form.binding/nbproject/project.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-is.eager=true
-javac.source=1.6
-spec.version.base=0.18.0
-requires.nb.javac=true
diff --git a/form.binding/nbproject/project.xml b/form.binding/nbproject/project.xml
deleted file mode 100644
index e035946..0000000
--- a/form.binding/nbproject/project.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project xmlns="http://www.netbeans.org/ns/project/1">
- <type>org.netbeans.modules.apisupport.project</type>
- <configuration>
- <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
- <code-name-base>org.netbeans.modules.form.binding</code-name-base>
- <module-dependencies>
- <dependency>
- <code-name-base>org.jdesktop.beansbinding</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.12</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.java.classpath</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.30</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.libs.javacapi</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.7</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.form</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>2</release-version>
- <implementation-version/>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.form.nb</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>0</release-version>
- <implementation-version/>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.49</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.filesystems</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.loaders</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.61</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.nodes</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.23</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util.ui</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util.lookup</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>8.10</specification-version>
- </run-dependency>
- </dependency>
- </module-dependencies>
- <public-packages/>
- </data>
- </configuration>
-</project>
diff --git a/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportImpl.java b/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportImpl.java
deleted file mode 100644
index b4b131c..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportImpl.java
+++ /dev/null
@@ -1,1543 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.form.binding;
-
-import com.sun.source.tree.*;
-import com.sun.source.util.TreePath;
-import com.sun.source.util.Trees;
-import java.beans.BeanDescriptor;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.*;
-import java.util.*;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.TypeParameterElement;
-import javax.lang.model.type.TypeKind;
-import javax.swing.JList;
-import javax.swing.JTable;
-import javax.swing.JComboBox;
-import javax.swing.JFormattedTextField;
-import javax.swing.JSlider;
-import javax.swing.JSpinner;
-import javax.swing.text.JTextComponent;
-import org.jdesktop.beansbinding.AutoBinding;
-import org.jdesktop.beansbinding.BeanProperty;
-import org.jdesktop.beansbinding.Binding;
-import org.jdesktop.beansbinding.BindingGroup;
-import org.jdesktop.beansbinding.Bindings;
-import org.jdesktop.beansbinding.Converter;
-import org.jdesktop.beansbinding.ELProperty;
-import org.jdesktop.beansbinding.ObjectProperty;
-import org.jdesktop.beansbinding.Property;
-import org.jdesktop.beansbinding.Validator;
-import org.jdesktop.beansbinding.ext.BeanAdapterFactory;
-import org.jdesktop.swingbinding.*;
-import org.netbeans.api.java.classpath.ClassPath;
-import org.netbeans.api.java.source.CancellableTask;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.TreeUtilities;
-import org.netbeans.api.project.libraries.Library;
-import org.netbeans.api.project.libraries.LibraryManager;
-import org.netbeans.modules.form.BindingDescriptor;
-import org.netbeans.modules.form.BindingDesignSupport;
-import org.netbeans.modules.form.BindingProperty;
-import org.netbeans.modules.form.ComponentContainer;
-import org.netbeans.modules.form.FormDesignValue;
-import org.netbeans.modules.form.FormEditor;
-import org.netbeans.modules.form.FormModel;
-import org.netbeans.modules.form.FormModelEvent;
-import org.netbeans.modules.form.FormModelListener;
-import org.netbeans.modules.form.FormProperty;
-import org.netbeans.modules.form.FormUtils;
-import org.netbeans.modules.form.FormUtils.TypeHelper;
-import org.netbeans.modules.form.MetaBinding;
-import org.netbeans.modules.form.RADComponent;
-import org.netbeans.modules.form.project.ClassPathUtils;
-import org.netbeans.modules.form.project.ClassSource;
-import org.netbeans.modules.nbform.project.ClassSourceResolver;
-import org.openide.ErrorManager;
-import org.openide.filesystems.FileObject;
-import org.openide.nodes.Node;
-import org.openide.util.Utilities;
-
-/**
- * Design support for beans binding.
- *
- * @author Jan Stola, Tomas Pavek
- */
-public class BindingDesignSupportImpl implements BindingDesignSupport {
- /** Form model. */
- private FormModel formModel;
-
- /** Realizations of bindings among replicated components. */
- private Map<MetaBinding, List<Binding>> bindingsMap = new HashMap<MetaBinding, List<Binding>>();
- /** Realizations of bindings among metacomponents. */
- private Map<MetaBinding, Binding> modelBindings = new HashMap<MetaBinding, Binding>();
- /** Binding to BindingGroup mapping. */
- private Map<Binding, BindingGroup> bindingToGroup = new HashMap<Binding, BindingGroup>();
- /** Binding group for reference instances in metacomponents. */
- private BindingGroup bindingGroup;
-
- /**
- * Create binding design support for the given form model.
- *
- * @param model form model to create the binding support for.
- */
- BindingDesignSupportImpl(FormModel model) {
- formModel = model;
-
- bindingGroup = new BindingGroup();
- bindingGroup.bind();
-
- formModel.addFormModelListener(new ModelListener());
- }
-
- /**
- * Changes the binding between two components (affects only replicated components).
- *
- * @param oldBinding the old definition of the binding.
- * @param newBinding the new definition of the binding.
- */
- private void changeBinding(MetaBinding oldBinding, MetaBinding newBinding) {
- if (oldBinding != null) {
- removeBindings(oldBinding);
- }
- // non-model bindings are added from VisualReplicator
- }
-
- /**
- * Changes the binding between two components (affects only reference instances in the model).
- *
- * @param oldBinding the old definition of the binding.
- * @param newBinding the new definition of the binding.
- */
- @Override
- public void changeBindingInModel(MetaBinding oldBinding, MetaBinding newBinding) {
- if (oldBinding != null) {
- removeBindingInModel(oldBinding);
- }
- if (newBinding != null) {
- addBindingInModel(newBinding);
- }
- }
-
- @Override
- public String elWrap(String path) {
- return (path == null) ? null : "${" + path + "}"; // NOI18N
- }
-
-
- @Override
- public boolean isSimpleExpression(String expression) {
- return isSimpleExpression0(expression);
- }
-
- private static boolean isSimpleExpression0(String expression) {
- return (expression.startsWith("${") && expression.endsWith("}")); // NOI18N
- }
-
- @Override
- public String unwrapSimpleExpression(String expression) {
- return unwrapSimpleExpression0(expression);
- }
-
- private static String unwrapSimpleExpression0(String expression) {
- if (isSimpleExpression0(expression)) {
- expression = expression.substring(2, expression.length()-1);
- }
- return expression;
- }
-
- private static boolean hasRelativeType(Class clazz, String property) {
- // selectedElement(_...), selectedElements(_...)
- return (("elements".equals(property) || property.startsWith("selectedElement")) // NOI18N
- && (javax.swing.JTable.class.isAssignableFrom(clazz) || javax.swing.JList.class.isAssignableFrom(clazz)))
- || (("selectedItem".equals(property)) && javax.swing.JComboBox.class.isAssignableFrom(clazz)); // NOI18N
- }
-
- // Used to determine binding properties only
- @Override
- public List<BindingDescriptor>[] getBindingDescriptors(RADComponent component) {
- BeanDescriptor beanDescriptor = component.getBeanInfo().getBeanDescriptor();
- List<BindingDescriptor>[] descs = getBindingDescriptors(null, beanDescriptor, false);
- Class<?> beanClass = component.getBeanClass();
- if (JTextComponent.class.isAssignableFrom(beanClass)) {
- // get rid of text_... descriptors
- descs[0] = filterDescriptors(descs[0], "text_"); // NOI18N
- } else if (JTable.class.isAssignableFrom(beanClass)
- || JList.class.isAssignableFrom(beanClass)
- || JComboBox.class.isAssignableFrom(beanClass)) {
- // get rid of selectedElement(s)_... descriptors
- descs[0] = filterDescriptors(descs[0], "selectedElement_"); // NOI18N
- descs[0] = filterDescriptors(descs[0], "selectedElements_"); // NOI18N
- // add elements descriptor
- BindingDescriptor desc = new BindingDescriptor("elements", List.class); // NOI18N
- descs[0].add(0, desc);
- } else if (JSlider.class.isAssignableFrom(beanClass)) {
- // get rid of value_... descriptor
- descs[0] = filterDescriptors(descs[0], "value_"); // NOI18N
- }
- return descs;
- }
-
- private List<BindingDescriptor> filterDescriptors(List<BindingDescriptor> descs, String forbiddenPrefix) {
- List<BindingDescriptor> filtered = new LinkedList<BindingDescriptor>();
- for (BindingDescriptor bd : descs) {
- if (!bd.getPath().startsWith(forbiddenPrefix)) { // NOI18N
- filtered.add(bd);
- }
- }
- return filtered;
- }
-
- private List<PropertyDescriptor> getSpecialBindingDescriptors(Class clazz) {
- List<PropertyDescriptor> descs = BeanAdapterFactory.getAdapterPropertyDescriptors(clazz);
- try {
- if (JComboBox.class.isAssignableFrom(clazz)) {
- PropertyDescriptor desc = new PropertyDescriptor("selectedItem", JComboBox.class); // NOI18N
- descs.add(desc);
- } else if (JSpinner.class.isAssignableFrom(clazz)) {
- PropertyDescriptor desc = new PropertyDescriptor("value", JSpinner.class); // NOI18N
- descs.add(desc);
- } else if (JFormattedTextField.class.isAssignableFrom(clazz)) {
- for (PropertyDescriptor pd : descs) {
- if ("text".equals(pd.getName())) { // NOI18N
- descs.remove(pd);
- break;
- }
- }
- PropertyDescriptor desc = new PropertyDescriptor("value", JFormattedTextField.class); // NOI18N
- descs.add(desc);
- }
- } catch (Exception ex) {
- Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);
- }
- return descs;
- }
-
- private List<BindingDescriptor>[] getBindingDescriptors(TypeHelper type, BeanDescriptor beanDescriptor, boolean includeReadOnly) {
- Class<?> beanClass = beanDescriptor.getBeanClass();
- List<BindingDescriptor> bindingList = new LinkedList<BindingDescriptor>();
- List<BindingDescriptor> prefList = new LinkedList<BindingDescriptor>();
- List<BindingDescriptor> observableList = new LinkedList<BindingDescriptor>();
- List<BindingDescriptor> nonObservableList = new LinkedList<BindingDescriptor>();
- List<BindingDescriptor> list;
- Object[] propsCats = FormUtils.getPropertiesCategoryClsf(beanClass, beanDescriptor);
- PropertyDescriptor[] pds;
- try {
- pds = FormUtils.getBeanInfo(beanClass).getPropertyDescriptors();
- } catch (Exception ex) {
- Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);
- pds = new PropertyDescriptor[0];
- }
- List<PropertyDescriptor> specialPds = getSpecialBindingDescriptors(beanClass);
- Map<String,PropertyDescriptor> pathToDesc = new HashMap<String,PropertyDescriptor>();
- if (Utilities.isMac()) {
- try {
- for (PropertyDescriptor pd : FormUtils.getBeanInfo(beanClass, Introspector.IGNORE_ALL_BEANINFO).getPropertyDescriptors()) {
- pathToDesc.put(pd.getName(), pd);
- }
- } catch (IntrospectionException iex) {
- Logger.getLogger(getClass().getName()).log(Level.INFO, iex.getMessage(), iex);
- }
- }
- for (PropertyDescriptor pd : pds) {
- pathToDesc.put(pd.getName(), pd);
- }
- for (PropertyDescriptor pd : specialPds) {
- if (pathToDesc.get(pd.getName()) != null) {
- pathToDesc.remove(pd.getName());
- }
- }
- List<PropertyDescriptor> allPds = new LinkedList<PropertyDescriptor>(specialPds);
- allPds.addAll(pathToDesc.values());
- int count = 0;
- for (PropertyDescriptor pd : allPds) {
- if (count++<specialPds.size()) {
- list = bindingList;
- } else {
- if (!includeReadOnly && (pd.getWriteMethod() == null)) {
- continue;
- }
- Object propCat = FormUtils.getPropertyCategory(pd, propsCats);
- if (propCat == FormUtils.PROP_HIDDEN) {
- // hidden property => hide also the binding property
- continue;
- } else {
- if (pd.isBound()) {
- // observable property
- if (propCat == FormUtils.PROP_PREFERRED) {
- list = prefList;
- } else {
- list = observableList;
- }
- } else {
- // non-observable property
- list = nonObservableList;
- }
- }
- }
-
- Method method = pd.getReadMethod();
- if ((method != null) && ("getClass".equals(method.getName()))) continue; // NOI18N
- Type retType = (method == null) ? pd.getPropertyType() : method.getGenericReturnType();
- if (retType == null) continue;
- BindingDescriptor bd;
- if (type == null) {
- bd = new BindingDescriptor(pd.getName(), retType);
- } else {
- TypeHelper t = new TypeHelper(retType, type.getActualTypeArgs()).normalize();
- bd = new BindingDescriptor(pd.getName(), t);
- }
- bd.setDisplayName(pd.getDisplayName());
- bd.setShortDescription(pd.getShortDescription());
-
- if (hasRelativeType(beanClass, bd.getPath())) {
- bd.markTypeAsRelative();
- }
-
- list.add(bd);
- }
-
- if (bindingList.isEmpty()) {
- bindingList = prefList;
- } else {
- observableList.addAll(prefList);
- }
- Comparator<BindingDescriptor> bdComparator = new Comparator<BindingDescriptor>() {
- @Override
- public int compare(BindingDescriptor o1, BindingDescriptor o2) {
- String path1 = o1.getPath();
- String path2 = o2.getPath();
- return path1.compareToIgnoreCase(path2);
- }
- };
- Collections.sort(bindingList, bdComparator);
- Collections.sort(observableList, bdComparator);
- Collections.sort(nonObservableList, bdComparator);
-
- return new List[] {bindingList, observableList, nonObservableList};
- }
-
- @Override
- public List<BindingDescriptor> getAllBindingDescriptors(TypeHelper type) {
- List<BindingDescriptor>[] descs = getBindingDescriptors(type);
- List<BindingDescriptor> list = new LinkedList<BindingDescriptor>();
- for (int i=0; i<descs.length; i++ ){
- list.addAll(descs[i]);
- }
- return list;
- }
-
- /**
- * Returns possible bindings for the given type.
- *
- * @param type type whose possible bindings should be returned.
- * @return list of <code>BindingDescriptor</code>s describing possible bindings.
- */
- @Override
- @SuppressWarnings("unchecked") // generic array creation NOI18N
- public List<BindingDescriptor>[] getBindingDescriptors(TypeHelper type) {
- List<BindingDescriptor> typesFromSource = Collections.emptyList();
- Class binarySuperClass = null;
- if (type.getType() == null) {
- FileObject fileInProject = FormEditor.getFormDataObject(formModel).getPrimaryFile();
- ClassPath cp = ClassPath.getClassPath(fileInProject, ClassPath.SOURCE);
- final List<BindingDescriptor> types = new LinkedList<BindingDescriptor>();
- final String[] superClass = new String[1];
- superClass[0] = type.getName();
- do {
- String typeName = superClass[0];
- final String resourceName = typeName.replace('.', '/') + ".java"; // NOI18N
- int lastDot = typeName.lastIndexOf('.');
- lastDot = (lastDot == -1) ? 0 : lastDot;
- final String simpleTypeName = typeName.substring(lastDot+1);
- FileObject fob = cp.findResource(resourceName);
- if (fob == null) {
- try {
- binarySuperClass = ClassPathUtils.loadClass(typeName, fileInProject);
- } catch (ClassNotFoundException cnfex) {}
- break;
- }
- JavaSource source = JavaSource.forFileObject(fob);
- try {
- source.runUserActionTask(new CancellableTask<CompilationController>() {
- @Override
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(JavaSource.Phase.RESOLVED);
- CompilationUnitTree cu = cc.getCompilationUnit();
- ClassTree clazz = null;
- for (Tree typeDecl : cu.getTypeDecls()) {
- if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) {
- ClassTree candidate = (ClassTree)typeDecl;
- if (candidate.getSimpleName().toString().equals(simpleTypeName)) {
- clazz = candidate;
- break;
- }
- }
- }
- if (clazz == null) { // issue 118690
- // should not happen
- Logger.getLogger(getClass().getName()).log(Level.INFO, "ClassTree not found in {0}", resourceName); // NOI18N
- superClass[0] = Object.class.getName();
- return;
- }
- for (Tree clMember : clazz.getMembers()) {
- if (clMember.getKind() == Tree.Kind.METHOD) {
- MethodTree method = (MethodTree)clMember;
- if (!method.getParameters().isEmpty()) continue;
- Set<javax.lang.model.element.Modifier> modifiers = method.getModifiers().getFlags();
- if (modifiers.contains(javax.lang.model.element.Modifier.STATIC)
- || !modifiers.contains(javax.lang.model.element.Modifier.PUBLIC)) {
- continue;
- }
- String methodName = method.getName().toString();
- Tree returnType = method.getReturnType();
-
- String propName;
- if (methodName.startsWith("get")) { // NOI18N
- propName = methodName.substring(3);
- } else if (methodName.startsWith("is")) { // NOI18N
- if ((returnType.getKind() == Tree.Kind.PRIMITIVE_TYPE)
- && (((PrimitiveTypeTree)returnType).getPrimitiveTypeKind() == TypeKind.BOOLEAN)) {
- propName = methodName.substring(2);
- } else {
- continue;
- }
- } else {
- continue;
- }
- if (propName.length() == 0) continue;
- if ((propName.length() == 1) || (Character.isLowerCase(propName.charAt(1)))) {
- propName = Character.toLowerCase(propName.charAt(0)) + propName.substring(1);
- }
-
- TypeHelper type;
- if (returnType.getKind() == Tree.Kind.PRIMITIVE_TYPE) {
- PrimitiveTypeTree ptree = (PrimitiveTypeTree)returnType;
- if (ptree.getPrimitiveTypeKind() == TypeKind.VOID) {
- continue; // void return type
- }
- type = new TypeHelper(ptree.toString());
- } else {
- type = treeToType(cc, returnType, formModel);
- }
- types.add(0, new BindingDescriptor(propName, type));
- }
- }
- Tree superTree = clazz.getExtendsClause();
- TypeHelper type = treeToType(cc, superTree, formModel);
- String typeName = type.getName();
- superClass[0] = (typeName == null) ? FormUtils.typeToClass(type).getName() : typeName;
- }
-
- @Override
- public void cancel() {
- }
-
- }, true);
- } catch (IOException ioex) {
- Logger.getLogger(getClass().getName()).log(Level.INFO, ioex.getMessage(), ioex);
- }
- } while (!Object.class.getName().equals(superClass[0]));
- typesFromSource = types;
- }
- List<BindingDescriptor>[] list = new List[] {Collections.emptyList(), typesFromSource, Collections.emptyList()};
- Class clazz = (type.getType() == null) ? binarySuperClass : FormUtils.typeToClass(type);
- if ((clazz != null) && !clazz.getName().startsWith("java.lang.") // NOI18N
- && !Collection.class.isAssignableFrom(clazz)
- && !java.util.Date.class.isAssignableFrom(clazz)
- && !clazz.isArray()) {
- try {
- BeanInfo beanInfo = FormUtils.getBeanInfo(clazz);
- List<BindingDescriptor>[] typesFromBinary = getBindingDescriptors(type, beanInfo.getBeanDescriptor(), true);
- Map<String,BindingDescriptor>[] maps = new Map[3];
- for (int i=0; i<3; i++) {
- maps[i] = listToMap(typesFromBinary[i]);
- }
- for (BindingDescriptor descriptor : typesFromSource) {
- String path = descriptor.getPath();
- int i;
- for (i=0; i<3; i++) {
- if (maps[i].containsKey(path)) break;
- }
- if (i == 3) {
- i = 1; // put into observablle properties by default
- }
- maps[i].put(path, descriptor);
- }
- for (int i=0; i<3; i++) {
- list[i] = new LinkedList<BindingDescriptor>(maps[i].values());
- }
- } catch (Exception ex) {
- Logger.getLogger(getClass().getName()).log(Level.INFO, ex.getMessage(), ex);
- }
- }
- return list;
- }
-
- private static TypeHelper treeToType(CompilationController cc, Tree tree, FormModel model) {
- String typeName = Object.class.getName();
- Map<String,TypeHelper> map = null;
- if (tree != null) {
- CompilationUnitTree cu = cc.getCompilationUnit();
- Trees trees = cc.getTrees();
- if (tree.getKind() == Tree.Kind.EXTENDS_WILDCARD) {
- tree = ((WildcardTree)tree).getBound();
- }
- TreePath path = trees.getPath(cu, tree);
- Element el = trees.getElement(path);
- if ((el != null) && ((el.getKind() == ElementKind.CLASS) || (el.getKind() == ElementKind.INTERFACE))) {
- TypeElement tel = (TypeElement) el;
- typeName = tel.getQualifiedName().toString();
- if (tree.getKind() == Tree.Kind.PARAMETERIZED_TYPE) {
- List<? extends Tree> params = ((ParameterizedTypeTree)tree).getTypeArguments();
- List<? extends TypeParameterElement> elems = tel.getTypeParameters();
- map = new HashMap<String,TypeHelper>();
- for (int i=0; i<params.size() && i<elems.size(); i++) {
- Tree param = params.get(0);
- TypeHelper paramType = treeToType(cc, param, model);
- TypeParameterElement elem = elems.get(0);
- map.put(elem.toString(), paramType);
- }
- }
- }
- }
- TypeHelper type = new TypeHelper(typeName, map);
- if (typeName.indexOf('.') != -1) {
- try {
- Class clazz = FormUtils.loadClass(typeName, model);
- type = new TypeHelper(clazz, map);
- } catch (ClassNotFoundException cnfex) {
- // not compiled - use just the name
- }
- }
- return type;
- }
-
- private static Map<String,BindingDescriptor> listToMap(List<BindingDescriptor> list) {
- Map<String,BindingDescriptor> map = new TreeMap<String,BindingDescriptor>();
- for (BindingDescriptor descriptor : list) {
- String path = descriptor.getPath();
- map.put(path, descriptor);
- }
- return map;
- }
-
- @Override
- public TypeHelper determineType(RADComponent comp) {
- TypeHelper type;
- if (comp.getFormModel().getTopRADComponent() == comp) {
- FileObject fob = FormEditor.getFormDataObject(comp.getFormModel()).getPrimaryFile();
- ClassPath cp = ClassPath.getClassPath(fob, ClassPath.SOURCE);
- String className = cp.getResourceName(fob, '.', false);
- type = new TypeHelper(className);
- } else {
- Type t = null;
- Map<String,TypeHelper> newMap = null;
- Class clazz = comp.getBeanClass();
- t = clazz;
- if (clazz.getTypeParameters().length == 1) {
- try {
- TypeHelper elemType = determineTypeParameter(comp);
- if (elemType != null) {
- newMap = new HashMap<String,TypeHelper>();
- newMap.put(clazz.getTypeParameters()[0].getName(), elemType);
- }
- } catch (Exception ex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, ex.getMessage(), ex);
- }
- }
- type = new TypeHelper(t, newMap);
- }
- return type;
- }
-
- static TypeHelper determineTypeParameter(final RADComponent comp) {
- FileObject fob = FormEditor.getFormDataObject(comp.getFormModel()).getPrimaryFile();
- JavaSource source = JavaSource.forFileObject(fob);
- final String varName = comp.getName();
- final TypeHelper[] result = new TypeHelper[1];
- try {
- source.runUserActionTask(new CancellableTask<CompilationController>() {
- @Override
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(JavaSource.Phase.RESOLVED);
- CompilationUnitTree cu = cc.getCompilationUnit();
- ClassTree clazz = null;
- for (Tree typeDecl : cu.getTypeDecls()) {
- if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) {
- clazz = (ClassTree) typeDecl;
- break;
- }
- }
- Node.Property prop = comp.getSyntheticProperty("useLocalVariable"); // NOI18N
- Object value = prop.getValue();
- VariableTree variable = null;
- if (Boolean.TRUE.equals(value)) {
- // local variable in initComponents()
- for (Tree clMember : clazz.getMembers()) {
- if (clMember.getKind() == Tree.Kind.METHOD) {
- MethodTree method = (MethodTree)clMember;
- String methodName = method.getName().toString();
- if ("initComponents".equals(methodName)) { // NOI18N
- for (StatementTree statement : method.getBody().getStatements()) {
- if (statement.getKind() == Tree.Kind.VARIABLE) {
- VariableTree var = (VariableTree)statement;
- if (varName.equals(var.getName().toString())) {
- variable = var;
- }
- }
- }
- }
- }
- }
- } else {
- // fields in class
- for (Tree clMember : clazz.getMembers()) {
- if (clMember.getKind() == Tree.Kind.VARIABLE) {
- VariableTree var = (VariableTree)clMember;
- if (varName.equals(var.getName().toString())) {
- variable = var;
- }
- }
- }
- }
- if (variable != null) {
- Tree type = variable.getType();
- if (type.getKind() == Tree.Kind.PARAMETERIZED_TYPE) {
- ParameterizedTypeTree params = (ParameterizedTypeTree)type;
- List<? extends Tree> args = params.getTypeArguments();
- if (args.size() == 1) {
- Tree tree = args.get(0);
- result[0] = treeToType(cc, tree, comp.getFormModel());
- }
- }
- }
- }
-
- @Override
- public void cancel() {
- }
- }, true);
- } catch (IOException ioex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, ioex.getMessage(), ioex);
- }
- if (result[0] == null) {
- // fallback - covers the situation where the component
- // has been added but the code hasn't been generated yet
- Class clazz = comp.getBeanClass();
- if (clazz.getTypeParameters().length == 1) {
- try {
- Object value = comp.getSyntheticProperty("typeParameters").getValue(); // NOI18N
- if (value instanceof String) {
- String type = (String)value;
- if (type.startsWith("<")) { // NOI18N
- type = type.substring(1, type.length()-1);
- Map<String,TypeHelper> newMap = new HashMap<String,TypeHelper>();
- try {
- Class elemType = ClassPathUtils.loadClass(type, FormEditor.getFormDataObject(comp.getFormModel()).getFormFile());
- newMap.put(clazz.getTypeParameters()[0].getName(), new TypeHelper(elemType));
- } catch (ClassNotFoundException cnfex) {
- newMap.put(clazz.getTypeParameters()[0].getName(), new TypeHelper(type));
- }
- result[0] = new TypeHelper(type, newMap);
- }
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, null, iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, null, itex);
- }
- }
- }
- return result[0];
- }
-
- @Override
- public TypeHelper determineType(RADComponent comp, String sourcePath) {
- String[] path = parsePath(sourcePath);
- TypeHelper type = determineType(comp);
- for (int i=0; i<path.length; i++) {
- String pathItem = path[i];
- List<BindingDescriptor> descriptors = getAllBindingDescriptors(type);
- BindingDescriptor descriptor = findDescriptor(descriptors, pathItem);
- if (descriptor == null) return new TypeHelper();
- type = descriptor.getGenericValueType();
- if (type == null) {
- if (javax.swing.JTable.class.isAssignableFrom(comp.getBeanClass())
- || javax.swing.JList.class.isAssignableFrom(comp.getBeanClass())
- || javax.swing.JComboBox.class.isAssignableFrom(comp.getBeanClass())) {
- MetaBinding binding = comp.getBindingProperty("elements").getValue(); // NOI18N
- if (binding != null) {
- RADComponent subComp = binding.getSource();
- String subSourcePath = binding.getSourcePath();
- subSourcePath = (subSourcePath == null) ? null : unwrapSimpleExpression(subSourcePath);
- // PENDING beware of stack overflow
- TypeHelper t = determineType(subComp, subSourcePath);
- if (javax.swing.JComboBox.class.isAssignableFrom(comp.getBeanClass())) {
- if ("selectedItem".equals(pathItem)) { // NOI18N
- type = t.typeOfElement();
- }
- } else {
- if ("selectedElement".equals(pathItem) || pathItem.startsWith("selectedElement_")) { // NOI18N
- type = t.typeOfElement();
- } else if (pathItem.startsWith("selectedElements") || "elements".equals(pathItem)) { // NOI18N
- type = t;
- }
- }
- } else {
- type = new TypeHelper();
- }
- }
- }
- }
- return type;
- }
-
- /**
- * Finds descriptor that corresponds to the given binding path.
- *
- * @param descriptors list of descriptors that should be searched.
- * @param path binding path to find descriptor for.
- * @return descriptor that corresponds to the given binding path.
- */
- private static BindingDescriptor findDescriptor(List<BindingDescriptor> descriptors, String path) {
- for (BindingDescriptor descriptor : descriptors) {
- if (descriptor.getPath().equals(path)) return descriptor;
- }
- return null;
- }
-
- /**
- * Parses binding path into segments.
- *
- * @param path path to parse.
- * @return segments of the binding path. The returned value cannot be <code>null</code>.
- */
- private static String[] parsePath(String path) {
- if (path == null) return new String[0];
- List<String> pathItems = new LinkedList<String>();
- int index;
- while ((index = path.indexOf('.')) != -1) {
- pathItems.add(path.substring(0,index));
- path = path.substring(index+1);
- }
- pathItems.add(path);
- return pathItems.toArray(new String[pathItems.size()]);
- }
-
- void establishUpdatedBindings(RADComponent metacomp, boolean recursive,
- Map map, BindingGroup group, boolean inModel) {
- for (MetaBinding bindingDef : collectBindingDefs(metacomp, recursive)) {
- RADComponent sourceComp = bindingDef.getSource();
- RADComponent targetComp = bindingDef.getTarget();
- if (sourceComp.isInModel() && targetComp.isInModel()) {
- if (inModel) {
- addBindingInModel(bindingDef);
- } else {
- Object source = null;
- if (map != null)
- source = map.get(sourceComp.getId());
- if (source == null)
- source = sourceComp.getBeanInstance(); // also used if clone not available
- Object target = map != null ?
- map.get(targetComp.getId()) : targetComp.getBeanInstance();
- if (source != null && target != null)
- addBinding(bindingDef, source, target, group, false);
- }
- }
- }
- }
-
- static void establishOneOffBindings(RADComponent metacomp,
- boolean recursive, Map map, BindingGroup group) {
- for (MetaBinding bindingDef : collectBindingDefs(metacomp, recursive)) {
- RADComponent sourceComp = bindingDef.getSource();
- RADComponent targetComp = bindingDef.getTarget();
- Object source = null;
- if (map != null)
- source = map.get(sourceComp.getId());
- if (source == null)
- source = sourceComp.getBeanInstance(); // also used if clone not available
- Object target = map != null ?
- map.get(targetComp.getId()) : targetComp.getBeanInstance();
- if (source != null && target != null)
- createBinding(bindingDef, source, target, group, null);
- }
- }
-
- private void releaseBindings(RADComponent metacomp, boolean recursive) {
- for (MetaBinding bindingDef : collectBindingDefs(metacomp, recursive)) {
- removeBindings(bindingDef); // unbinds and removes all bindings
- // created according to this definition
- }
- }
-
- private static Collection<MetaBinding> collectBindingDefs(RADComponent metacomp, boolean recursive) {
- Collection<MetaBinding> col = collectBindingDefs(metacomp, recursive, null);
- if (col == null)
- col = Collections.emptyList();
- return col;
- }
-
- private static Collection<MetaBinding> collectBindingDefs(
- RADComponent metacomp, boolean recursive, Collection<MetaBinding> col)
- {
- for (BindingProperty bProp : metacomp.getKnownBindingProperties()) {
- MetaBinding bindingDef = bProp.getValue();
- if (bindingDef != null) {
- if (col == null)
- col = new LinkedList<MetaBinding>();
- col.add(bindingDef);
- }
- }
-
- if (recursive && metacomp instanceof ComponentContainer) {
- for (RADComponent subcomp : ((ComponentContainer)metacomp).getSubBeans()) {
- col = collectBindingDefs(subcomp, recursive, col);
- }
- }
-
- return col;
- }
-
- private void addBindingInModel(MetaBinding bindingDef) {
- addBinding(bindingDef,
- bindingDef.getSource().getBeanInstance(),
- bindingDef.getTarget().getBeanInstance(),
- bindingGroup, true);
- }
-
- /**
- * Creates binding according to given MetaBinding between given source and
- * target objects. The binding is registered, so it is automatically unbound
- * and removed when the MetaBinding is removed (or the source/target component).
- *
- * @param bindingDef description of the binding
- * @param source binding source
- * @param target binding target
- * @param group binding group where the binding should be added
- * @param inModel determines whether we are creating binding in the model
- */
- void addBinding(MetaBinding bindingDef, Object source, Object target,
- BindingGroup group, boolean inModel) {
- if (inModel) {
- if (modelBindings.get(bindingDef) == null) {
- modelBindings.put(bindingDef, createBinding(bindingDef, source, target, group, bindingToGroup));
- }
- } else {
- List<Binding> establishedBindings = bindingsMap.get(bindingDef);
- if (establishedBindings != null) {
- for (Binding binding : establishedBindings) {
- if (binding.getSourceObject() == source
- && binding.getTargetObject() == target)
- return; // this binding already exists
- }
- }
- else {
- establishedBindings = new LinkedList<Binding>();
- bindingsMap.put(bindingDef, establishedBindings);
- }
- establishedBindings.add(createBinding(bindingDef, source, target, group, bindingToGroup));
- }
- }
-
- private static String actualTargetPath(MetaBinding bindingDef) {
- String targetPath = bindingDef.getTargetPath();
- if ("text".equals(targetPath)) { // NOI18N
- Class<?> targetClass = bindingDef.getTarget().getBeanClass();
- if (JTextComponent.class.isAssignableFrom(targetClass)) {
- String strategy = bindingDef.getParameter(MetaBinding.TEXT_CHANGE_STRATEGY);
- if (MetaBinding.TEXT_CHANGE_ON_ACTION_OR_FOCUS_LOST.equals(strategy)) {
- targetPath += "_ON_ACTION_OR_FOCUS_LOST"; // NOI18N
- } else if (MetaBinding.TEXT_CHANGE_ON_FOCUS_LOST.equals(strategy)) {
- targetPath += "_ON_FOCUS_LOST"; // NOI18N
- }
- }
- } else if ("selectedElement".equals(targetPath) || "selectedElements".equals(targetPath)) { // NOI18N
- Class<?> targetClass = bindingDef.getTarget().getBeanClass();
- if (JList.class.isAssignableFrom(targetClass)
- || JTable.class.isAssignableFrom(targetClass)
- || JComboBox.class.isAssignableFrom(targetClass)) {
- String value = bindingDef.getParameter(MetaBinding.IGNORE_ADJUSTING_PARAMETER);
- if ("Y".equals(value)) { // NOI18N
- targetPath += "_IGNORE_ADJUSTING"; // NOI18N
- }
- }
- } else if ("value".equals(targetPath)) { // NOI18N
- Class<?> targetClass = bindingDef.getTarget().getBeanClass();
- if (JSlider.class.isAssignableFrom(targetClass)) {
- String value = bindingDef.getParameter(MetaBinding.IGNORE_ADJUSTING_PARAMETER);
- if ("Y".equals(value)) { // NOI18N
- targetPath += "_IGNORE_ADJUSTING"; // NOI18N
- }
- }
- }
- return targetPath;
- }
-
- private static void generateTargetProperty(MetaBinding bindingDef, StringBuilder buf) {
- String targetPath = actualTargetPath(bindingDef);
- String property = BeanProperty.class.getName() + ".create(\"" + targetPath + "\")"; // NOI18N
- buf.append(property);
- }
-
- private static Property createTargetProperty(MetaBinding bindingDef) {
- String targetPath = actualTargetPath(bindingDef);
- Property property = BeanProperty.create(targetPath);
- return property;
- }
-
- @Override
- public String generateBinding(BindingProperty prop, StringBuilder buf, CodeGeneratorContext generator) {
- String variable;
- MetaBinding bindingDef = prop.getValue();
- // Update strategy
- int updateStrategy = bindingDef.getUpdateStrategy();
- String strategy = AutoBinding.class.getName() + ".UpdateStrategy."; // NOI18N
- if (updateStrategy == MetaBinding.UPDATE_STRATEGY_READ) {
- strategy += "READ"; // NOI18N
- } else if (updateStrategy == MetaBinding.UPDATE_STRATEGY_READ_ONCE) {
- strategy += "READ_ONCE"; // NOI18N
- } else {
- strategy += "READ_WRITE"; // NOI18N
- }
- strategy += ", "; // NOI18N
-
- RADComponent target = bindingDef.getTarget();
- Class targetClass = target.getBeanClass();
- String targetPath = bindingDef.getTargetPath();
- String sourcePath = bindingDef.getSourcePath();
- Class<?> sourceClass = bindingDef.getSource().getBeanClass();
- if ("elements".equals(targetPath) && JTable.class.isAssignableFrom(targetClass)
- && (List.class.isAssignableFrom(sourceClass) || (sourcePath != null))) { // NOI18N
- String elVariable = elVariableHelper(sourcePath, buf, generator);
- variable = generator.getBindingDescriptionVariable(JTableBinding.class, buf, false);
- if (variable == null) {
- variable = generator.getBindingDescriptionVariable(JTableBinding.class, buf, true);
- buf.append(' ');
- }
- buf.append(variable);
- buf.append(" = "); // NOI18N
- buf.append(SwingBindings.class.getName()).append(".createJTableBinding("); // NOI18N
- buf.append(strategy);
- buf.append(generator.getExpressionJavaString(bindingDef.getSource().getCodeExpression(), "this")); // NOI18N
- buf.append(", "); // NOI18N
- if (sourcePath != null) {
- buf.append(elVariable);
- buf.append(", "); // NOI18N
- }
- buf.append(generator.getExpressionJavaString(bindingDef.getTarget().getCodeExpression(), "this")); // NOI18N
- buildBindingNameCode(prop, buf);
- buf.append(");\n"); // NOI18N
- if (bindingDef.hasSubBindings()) {
- for (MetaBinding sub : bindingDef.getSubBindings()) {
- String columnVariable = generator.getBindingDescriptionVariable(JTableBinding.ColumnBinding.class, buf, false);
- if (columnVariable == null) {
- columnVariable = generator.getBindingDescriptionVariable(JTableBinding.ColumnBinding.class, buf, true);
- buf.append(' ');
- }
- buf.append(columnVariable);
- buf.append(" = "); // NOI18N
- buf.append(variable);
- String subSourcePath = sub.getSourcePath();
- buf.append(".addColumnBinding("); // NOI18N
- if ((subSourcePath == null) || "null".equals(subSourcePath)) { // NOI18N
- buf.append(ObjectProperty.class.getName());
- buf.append(".create()"); // NOI18N
- } else {
- buf.append(ELProperty.class.getName());
- buf.append(".create(\""); // NOI18N
- buf.append(subSourcePath);
- buf.append("\")"); // NOI18N
- }
- buf.append(");\n"); // NOI18N
- String title = sub.getParameter(MetaBinding.NAME_PARAMETER);
- if (title == null) {
- title = subSourcePath;
- if (isSimpleExpression(title)) {
- title = unwrapSimpleExpression(title);
- title = capitalize(title);
- }
- }
- if ((title != null) && (!"null".equals(title))) { // NOI18N
- buf.append(columnVariable);
- buf.append(".setColumnName(\""); // NOI18N
- buf.append(title);
- buf.append("\");\n"); // NOI18N
- }
- String columnClass = sub.getParameter(MetaBinding.TABLE_COLUMN_CLASS_PARAMETER);
- if (columnClass != null) {
- buf.append(columnVariable);
- buf.append(".setColumnClass("); // NOI18N
- buf.append(columnClass);
- buf.append(");\n"); // NOI18N
- }
- String editable = sub.getParameter(MetaBinding.EDITABLE_PARAMETER);
- if (editable != null) {
- buf.append(columnVariable);
- buf.append(".setEditable("); // NOI18N
- buf.append(editable);
- buf.append(");\n"); // NOI18N
- }
- }
- }
- } else if ("elements".equals(targetPath) && javax.swing.JList.class.isAssignableFrom(targetClass)
- && (List.class.isAssignableFrom(sourceClass) || (sourcePath != null))) { // NOI18N
- String elVariable = elVariableHelper(sourcePath, buf, generator);
- variable = generator.getBindingDescriptionVariable(JListBinding.class, buf, false);
- if (variable == null) {
- variable = generator.getBindingDescriptionVariable(JListBinding.class, buf, true);
- buf.append(' ');
- }
- buf.append(variable);
- buf.append(" = "); // NOI18N
- buf.append(SwingBindings.class.getName()).append(".createJListBinding("); // NOI18N
- buf.append(strategy);
- buf.append(generator.getExpressionJavaString(bindingDef.getSource().getCodeExpression(), "this")); // NOI18N
- buf.append(", "); // NOI18N
- if (sourcePath != null) {
- buf.append(elVariable);
- buf.append(", "); // NOI18N
- }
- buf.append(generator.getExpressionJavaString(bindingDef.getTarget().getCodeExpression(), "this")); // NOI18N
- buildBindingNameCode(prop, buf);
- buf.append(");\n"); // NOI18N
- String detailPath = bindingDef.getParameter(MetaBinding.DISPLAY_PARAMETER);
- if (detailPath != null) {
- buf.append(variable);
- buf.append(".setDetailBinding("); // NOI18N
- buf.append(ELProperty.class.getName());
- buf.append(".create(\""); // NOI18N
- buf.append(detailPath);
- buf.append("\"));\n"); // NOI18N
- }
- } else if ("elements".equals(targetPath) && javax.swing.JComboBox.class.isAssignableFrom(targetClass)
- && (List.class.isAssignableFrom(sourceClass) || (sourcePath != null))) { // NOI18N
- String elVariable = elVariableHelper(sourcePath, buf, generator);
- variable = generator.getBindingDescriptionVariable(JComboBoxBinding.class, buf, false);
- if (variable == null) {
- variable = generator.getBindingDescriptionVariable(JComboBoxBinding.class, buf, true);
- buf.append(' ');
- }
- buf.append(variable);
- buf.append(" = "); // NOI18N
- buf.append(SwingBindings.class.getName()).append(".createJComboBoxBinding("); // NOI18N
- buf.append(strategy);
- buf.append(generator.getExpressionJavaString(bindingDef.getSource().getCodeExpression(), "this")); // NOI18N
- buf.append(", "); // NOI18N
- if (sourcePath != null) {
- buf.append(elVariable);
- buf.append(", "); // NOI18N
- }
- buf.append(generator.getExpressionJavaString(bindingDef.getTarget().getCodeExpression(), "this")); // NOI18N
- buildBindingNameCode(prop, buf);
- buf.append(");\n"); // NOI18N
- } else {
- variable = generator.getBindingDescriptionVariable(Binding.class, buf, false);
- StringBuilder sb = new StringBuilder();
- if (variable == null) {
- variable = generator.getBindingDescriptionVariable(Binding.class, buf, true);
- buf.append(' ');
- buf.append(sb);
- }
- buf.append(variable);
- buf.append(" = "); // NOI18N
- buf.append(Bindings.class.getName()).append(sb).append(".createAutoBinding("); // NOI18N
- buf.append(strategy);
- buildBindingParamsCode(prop, buf, generator);
- }
- return variable;
- }
-
- private static ELProperty createELProperty(String path) {
- ELProperty property;
- try {
- property = ELProperty.create(path);
- } catch (Exception ex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, ex.getMessage(), ex);
- // fallback
- property = ELProperty.create("error"); // NOI18N
- }
- return property;
- }
-
- private static String elVariableHelper(String sourcePath, StringBuilder buf, CodeGeneratorContext generator) {
- String elVariable = null;
- if (sourcePath != null) {
- elVariable = generator.getBindingDescriptionVariable(ELProperty.class, buf, false);
- if (elVariable == null) {
- elVariable = generator.getBindingDescriptionVariable(ELProperty.class, buf, true);
- buf.append(' ');
- }
- buf.append(elVariable);
- buf.append(" = "); // NOI18N
- buf.append(ELProperty.class.getName());
- buf.append(".create(\""); // NOI18N
- buf.append(sourcePath);
- buf.append("\");\n"); // NOI18N
- }
- return elVariable;
- }
-
- private static void buildBindingParamsCode(BindingProperty prop, StringBuilder buf, CodeGeneratorContext generator) {
- MetaBinding bindingDef = prop.getValue();
- String sourcePath = bindingDef.getSourcePath();
- String targetPath = bindingDef.getTargetPath();
- buf.append(generator.getExpressionJavaString(bindingDef.getSource().getCodeExpression(), "this")); // NOI18N
- buf.append(", "); // NOI18N
- if (sourcePath != null) {
- buf.append(ELProperty.class.getName());
- buf.append(".create(\""); // NOI18N
- buf.append(sourcePath);
- buf.append("\")"); // NOI18N
- } else {
- buf.append(ObjectProperty.class.getName());
- buf.append(".create()"); // NOI18N
- }
- buf.append(", "); // NOI18N
- buf.append(generator.getExpressionJavaString(bindingDef.getTarget().getCodeExpression(), "this")); // NOI18N
- buf.append(", "); // NOI18N
- if (targetPath != null) {
- generateTargetProperty(bindingDef, buf);
- } else {
- buf.append(ObjectProperty.class.getName());
- buf.append(".create()"); // NOI18N
- }
- buildBindingNameCode(prop, buf);
- buf.append(");\n"); // NOI18N
- }
-
- private static void buildBindingNameCode(BindingProperty prop, StringBuilder buf) {
- MetaBinding bindingDef = prop.getValue();
- if (bindingDef.isNameSpecified()) {
- try {
- FormProperty property = prop.getNameProperty();
- Object value = property.getValue();
- if (value != null) {
- buf.append(", "); // NOI18N
- buf.append(property.getJavaInitializationString());
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- }
- }
-
- private static Binding createBinding0(MetaBinding bindingDef, Object source, Object target, BindingGroup group) {
- String name = null;
- if (bindingDef.isNameSpecified()) {
- BindingProperty prop = bindingDef.getTarget().getBindingProperty(bindingDef.getTargetPath());
- FormProperty nameProp = prop.getNameProperty();
- try {
- Object value = nameProp.getRealValue();
- if ((value != null) && (value instanceof String)) {
- name = (String)value;
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- if ((name != null) && group.getBinding(name) != null) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, "More than one binding with name: {0}", name); // NOI18N
- name = null; // ignore name parameter
- }
- }
- AutoBinding.UpdateStrategy updateStrategy = AutoBinding.UpdateStrategy.READ_WRITE;
- switch (bindingDef.getUpdateStrategy()) {
- case MetaBinding.UPDATE_STRATEGY_READ_WRITE:
- updateStrategy = AutoBinding.UpdateStrategy.READ_WRITE;
- break;
- case MetaBinding.UPDATE_STRATEGY_READ:
- updateStrategy = AutoBinding.UpdateStrategy.READ;
- break;
- case MetaBinding.UPDATE_STRATEGY_READ_ONCE:
- updateStrategy = AutoBinding.UpdateStrategy.READ_ONCE;
- break;
- default: assert false;
- }
- Binding<Object,?,Object,?> binding;
- Property targetProperty = createTargetProperty(bindingDef);
- Property sourceProperty = (bindingDef.getSourcePath() == null) ? ObjectProperty.create() : createELProperty(bindingDef.getSourcePath());
- RADComponent targetComp = bindingDef.getTarget();
- String targetPath = bindingDef.getTargetPath();
- String sourcePath = bindingDef.getSourcePath();
- if ("elements".equals(targetPath) && javax.swing.JTable.class.isAssignableFrom(targetComp.getBeanClass())
- && ((source instanceof List) || (sourcePath != null))) { // NOI18N
- JTableBinding<Object,Object,Object> tableBinding;
- if (sourcePath == null) {
- tableBinding = SwingBindings.createJTableBinding(updateStrategy, (List)source, (JTable)target, name);
- } else {
- tableBinding = SwingBindings.createJTableBinding(updateStrategy, source, sourceProperty, (JTable)target, name);
- }
- if (bindingDef.hasSubBindings()) {
- Collection<MetaBinding> subBindings = bindingDef.getSubBindings();
- for (MetaBinding sub : subBindings) {
- Property prop;
- String subSourcePath = sub.getSourcePath();
- if ((subSourcePath == null) || ("null".equals(subSourcePath))) { // NOI18N
- prop = ObjectProperty.create();
- } else {
- prop = createELProperty(subSourcePath);
- }
- JTableBinding.ColumnBinding columnBinding = tableBinding.addColumnBinding(prop);
- String title = sub.getParameter(MetaBinding.NAME_PARAMETER);
- if (title == null) {
- title = sub.getSourcePath();
- if (isSimpleExpression0(title)) {
- title = unwrapSimpleExpression0(title);
- title = capitalize0(title);
- }
- }
- columnBinding.setColumnName(title);
- String columnClass = sub.getParameter(MetaBinding.TABLE_COLUMN_CLASS_PARAMETER);
- if (columnClass != null) {
- try {
- if (columnClass.trim().endsWith(".class")) { // NOI18N
- columnClass = columnClass.trim();
- columnClass = columnClass.substring(0, columnClass.length()-6);
- }
- if (columnClass.indexOf('.') == -1) {
- StringBuilder sb = new StringBuilder();
- while (columnClass.endsWith("[]")) { // NOI18N
- columnClass = columnClass.substring(0, columnClass.length()-2);
- sb.append("["); // NOI18N
- }
- String prefix = sb.toString();
- if ("".equals(prefix)) { // NOI18N
- columnClass = "java.lang." + columnClass; // NOI18N
- } else {
- String suffix = columnClass;
- if (columnClass.equals("boolean")) { // NOI18N
- suffix = "Z"; // NOI18N
- } else if (columnClass.equals("byte")) { // NOI18N
- suffix = "B"; // NOI18N
- } else if (columnClass.equals("char")) { // NOI18N
- suffix = "C"; // NOI18N
- } else if (columnClass.equals("char")) { // NOI18N
- suffix = "D"; // NOI18N
- } else if (columnClass.equals("float")) { // NOI18N
- suffix = "F"; // NOI18N
- } else if (columnClass.equals("int")) { // NOI18N
- suffix = "I"; // NOI18N
- } else if (columnClass.equals("long")) { // NOI18N
- suffix = "J"; // NOI18N
- } else if (columnClass.equals("short")) { // NOI18N
- suffix = "S"; // NOI18N
- } else {
- prefix += "L"; // NOI18N
- if (suffix.indexOf('.') == -1) {
- suffix = "java.lang." + suffix; // NOI18N
- }
- suffix += ";"; // NOI18N
- }
- columnClass = prefix + suffix;
- }
- }
- Class<?> clazz = FormUtils.loadClass(columnClass, bindingDef.getSource().getFormModel());
- columnBinding.setColumnClass(clazz);
- } catch (ClassNotFoundException cnfex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, cnfex.getMessage(), cnfex);
- }
- }
- String editable = sub.getParameter(MetaBinding.EDITABLE_PARAMETER);
- if (editable != null) {
- Boolean value = "false".equals(editable) ? Boolean.FALSE : Boolean.TRUE; // NOI18N
- columnBinding.setEditable(value);
- }
- }
- }
- binding = tableBinding;
- } else if ("elements".equals(targetPath) && javax.swing.JList.class.isAssignableFrom(targetComp.getBeanClass())
- && ((source instanceof List) || (sourcePath != null))) { // NOI18N
- JListBinding listBinding;
- if (sourcePath == null) {
- listBinding = SwingBindings.createJListBinding(updateStrategy, (List)source, (JList)target, name);
- } else {
- listBinding = SwingBindings.createJListBinding(updateStrategy, source, sourceProperty, (JList)target, name);
- }
- String detailPath = bindingDef.getParameter(MetaBinding.DISPLAY_PARAMETER);
- if (detailPath != null) {
- listBinding.setDetailBinding(createELProperty(detailPath));
- }
- binding = listBinding;
- } else if ("elements".equals(targetPath) && javax.swing.JComboBox.class.isAssignableFrom(targetComp.getBeanClass())
- && ((source instanceof List) || (sourcePath != null))) { // NOI18N
- JComboBoxBinding comboBinding;
- if (sourcePath == null) {
- comboBinding = SwingBindings.createJComboBoxBinding(updateStrategy, (List)source, (JComboBox)target, name);
- } else {
- comboBinding = SwingBindings.createJComboBoxBinding(updateStrategy, source, sourceProperty, (JComboBox)target, name);
- }
-// String detailPath = bindingDef.getParameter(MetaBinding.DISPLAY_PARAMETER);
-// if (detailPath != null) {
-// comboBinding.setDetailBinding(createELProperty(detailPath));
-// }
- binding = comboBinding;
- } else {
- binding = Bindings.createAutoBinding(updateStrategy, source, sourceProperty, target, targetProperty, name);
- }
- return binding;
- }
-
- private static Binding createBinding(MetaBinding bindingDef,
- Object source, Object target,
- BindingGroup group,
- Map<Binding,BindingGroup> bindingToGroup) {
- Binding<Object,Object,Object,Object> binding = (Binding<Object,Object,Object,Object>)createBinding0(bindingDef, source, target, group);
- if (bindingDef.isNullValueSpecified()) {
- BindingProperty prop = bindingDef.getTarget().getBindingProperty(bindingDef.getTargetPath());
- FormProperty nullProp = prop.getNullValueProperty();
- try {
- Object value = nullProp.getRealValue();
- if ((value != null) && (value != FormDesignValue.IGNORED_VALUE)) {
- binding.setSourceNullValue(value);
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- }
- if (bindingDef.isIncompletePathValueSpecified()) {
- BindingProperty prop = bindingDef.getTarget().getBindingProperty(bindingDef.getTargetPath());
- FormProperty incompleteProp = prop.getIncompleteValueProperty();
- try {
- Object value = incompleteProp.getRealValue();
- if ((value != null) && (value != FormDesignValue.IGNORED_VALUE)) {
- binding.setSourceUnreadableValue(value);
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- }
- if (bindingDef.isConverterSpecified()) {
- BindingProperty prop = bindingDef.getTarget().getBindingProperty(bindingDef.getTargetPath());
- FormProperty converterProp = prop.getConverterProperty();
- try {
- Object value = converterProp.getRealValue();
- if ((value != null) && (value instanceof Converter)) {
- binding.setConverter((Converter)value);
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- }
- if (bindingDef.isValidatorSpecified()) {
- BindingProperty prop = bindingDef.getTarget().getBindingProperty(bindingDef.getTargetPath());
- FormProperty validatorProp = prop.getValidatorProperty();
- try {
- Object value = validatorProp.getRealValue();
- if ((value != null) && (value instanceof Validator)) {
- binding.setValidator((Validator)value);
- }
- } catch (IllegalAccessException iaex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, iaex.getMessage(), iaex);
- } catch (InvocationTargetException itex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, itex.getMessage(), itex);
- }
- }
- group.addBinding(binding);
- if (bindingToGroup != null) {
- bindingToGroup.put(binding, group);
- }
-
- try {
- binding.bind();
- } catch (Exception ex) {
- Logger.getLogger(BindingDesignSupportImpl.class.getName()).log(Level.INFO, ex.getMessage(), ex);
- }
- return binding;
- }
-
- private void removeBindings(MetaBinding bindingDef) {
- removeBindingInModel(bindingDef);
- List<Binding> establishedBindings = bindingsMap.get(bindingDef);
- if (establishedBindings != null) {
- for (Binding binding : establishedBindings) {
- removeBinding(binding);
- }
- bindingsMap.remove(bindingDef);
- }
- }
-
- private void removeBinding(Binding binding) {
- BindingGroup group = bindingToGroup.remove(binding);
- // It may happen that binding.bind() fails. Binding may
- // stay unbound in such situation and binding.unbind()
- // throws exception is this case
- if (binding.isBound()) {
- binding.unbind();
- }
- group.removeBinding(binding);
- }
-
- private void removeBindingInModel(MetaBinding bindingDef) {
- Binding binding = modelBindings.remove(bindingDef);
- if (binding != null) {
- removeBinding(binding);
- }
- }
-
- @Override
- public String capitalize(String title) {
- return capitalize0(title);
- }
-
- static String capitalize0(String title) {
- StringBuilder builder = new StringBuilder(title);
- boolean lastWasUpper = false;
- for (int i = 0; i < builder.length(); i++) {
- char aChar = builder.charAt(i);
- if (i == 0) {
- builder.setCharAt(i, Character.toUpperCase(aChar));
- lastWasUpper = true;
- } else if (Character.isUpperCase(aChar)) {
- if (!lastWasUpper) {
- builder.insert(i, ' ');
- }
- lastWasUpper = true;
- i++;
- } else {
- lastWasUpper = false;
- }
- }
- return builder.toString();
- }
-
- @Override
- public BindingVisualReplicator createReplicator() {
- return new BindingVisualReplicatorImpl();
- }
-
- @Override
- public Class getBindingGroupClass() {
- return BindingGroup.class;
- }
-
- @Override
- public Class getConverterClass() {
- return Converter.class;
- }
-
- @Override
- public Class getValidatorClass() {
- return Validator.class;
- }
-
- @Override
- public boolean updateProjectForBeansBinding() {
- FormEditor formEditor = FormEditor.getFormEditor(formModel);
- if (formEditor != null
- && !ClassPathUtils.isOnClassPath(formEditor.getFormDataObject().getFormFile(), Binding.class.getName())) {
- try {
- Library lib = LibraryManager.getDefault().getLibrary("beans-binding"); // NOI18N
- if (lib == null) {
- return false;
- }
- ClassSource cs = new ClassSource("", // class name is not needed // NOI18N
- new ClassSourceResolver.LibraryEntry(lib));
- ClassPathUtils.updateProject(formEditor.getFormDataObject().getFormFile(), cs, true);
- return true;
- }
- catch (IOException ex) {
- ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);
- }
- }
- return false;
- }
-
- private class BindingVisualReplicatorImpl implements BindingVisualReplicator {
- private BindingGroup group;
-
- BindingVisualReplicatorImpl() {
- group = new BindingGroup();
- group.bind();
- }
-
- @Override
- public void addBinding(MetaBinding bindingDef, Object source, Object target, boolean inModel) {
- BindingDesignSupportImpl.this.addBinding(bindingDef, source, target, group, inModel);
- }
-
- @Override
- public void establishUpdatedBindings(RADComponent metacomp, boolean recursive, Map map, boolean inModel) {
- BindingDesignSupportImpl.this.establishUpdatedBindings(metacomp, recursive, map, group, inModel);
- }
-
- @Override
- public void establishOneOffBindings(RADComponent metacomp, boolean recursive, Map map) {
- BindingDesignSupportImpl.establishOneOffBindings(metacomp, recursive, map, group);
- }
-
- }
-
- /**
- * Form model listener that updates the bindings.
- */
- private class ModelListener implements FormModelListener {
- @Override
- public void formChanged(FormModelEvent[] events) {
- if (events == null)
- return;
-
- for (int i=0; i < events.length; i++) {
- FormModelEvent ev = events[i];
- switch (ev.getChangeType()) {
- case FormModelEvent.BINDING_PROPERTY_CHANGED:
- if (ev.getSubPropertyName() == null) {
- changeBinding(ev.getOldBinding(), ev.getNewBinding());
- }
- break;
- case FormModelEvent.COMPONENT_REMOVED:
- releaseBindings(ev.getComponent(), true);
- break;
- case FormModelEvent.COMPONENT_ADDED:
- if (!ev.getCreatedDeleted()) {
- establishUpdatedBindings(ev.getComponent(), true, null, bindingGroup, true);
- }
- break;
- default:
- }
- }
- }
- }
-
- static class ModifiableBoolean {
- boolean value;
- }
-
-}
diff --git a/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportProviderImpl.java b/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportProviderImpl.java
deleted file mode 100644
index 5946cc5..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/BindingDesignSupportProviderImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.form.binding;
-
-import org.netbeans.modules.form.BindingDesignSupport;
-import org.netbeans.modules.form.BindingDesignSupportProvider;
-import org.netbeans.modules.form.FormModel;
-import org.openide.util.lookup.ServiceProvider;
-
-/**
- * Provider of binding support.
- *
- * @author Jan Stola
- */
-@ServiceProvider(service=BindingDesignSupportProvider.class)
-public class BindingDesignSupportProviderImpl implements BindingDesignSupportProvider {
-
- @Override
- public BindingDesignSupport create(FormModel formModel) {
- return new BindingDesignSupportImpl(formModel);
- }
-
-}
diff --git a/form.binding/src/org/netbeans/modules/form/binding/Bundle.properties b/form.binding/src/org/netbeans/modules/form/binding/Bundle.properties
deleted file mode 100644
index f3ad39a..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/Bundle.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-OpenIDE-Module-Name=Beans Binding Support for Form Editor
-OpenIDE-Module-Short-Description=Visual support for keeping two JavaBeans properties synchronized.
-OpenIDE-Module-Long-Description=Beans Binding provides a visual support for keeping two JavaBeans properties synchronzied.
-OpenIDE-Module-Display-Category=Java
diff --git a/form.binding/src/org/netbeans/modules/form/binding/resources/BindingSystemClasses.txt b/form.binding/src/org/netbeans/modules/form/binding/resources/BindingSystemClasses.txt
deleted file mode 100644
index e05d6ad..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/resources/BindingSystemClasses.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.jdesktop.beansbinding.*
\ No newline at end of file
diff --git a/form.binding/src/org/netbeans/modules/form/binding/resources/Bundle.properties b/form.binding/src/org/netbeans/modules/form/binding/resources/Bundle.properties
deleted file mode 100644
index ff20025..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/resources/Bundle.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# library name
-beans-binding=Beans Binding
diff --git a/form.binding/src/org/netbeans/modules/form/binding/resources/beans_binding.xml b/form.binding/src/org/netbeans/modules/form/binding/resources/beans_binding.xml
deleted file mode 100644
index c9de109..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/resources/beans_binding.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<!DOCTYPE library PUBLIC "-//NetBeans//DTD Library Declaration 1.0//EN" "http://www.netbeans.org/dtds/library-declaration-1_0.dtd">
-
-<library version="3.0" xmlns="http://www.netbeans.org/ns/library-declaration/3">
- <name>beans-binding</name>
- <type>j2se</type>
- <localizing-bundle>org.netbeans.modules.form.binding.resources.Bundle</localizing-bundle>
- <volume>
- <type>classpath</type>
- <resource>jar:nbinst://org.jdesktop.beansbinding/modules/ext/beansbinding-1.2.1.jar!/</resource>
- </volume>
- <volume>
- <type>javadoc</type>
- <resource>jar:nbinst://org.jdesktop.beansbinding/docs/beansbinding-1.2.1-doc.zip!/</resource>
- </volume>
- <properties>
- <!-- please check with mkleint@netbeans.org before/after updating this or "classpath" section -->
- <property>
- <name>maven-dependencies</name>
- <value>org.jdesktop:beansbinding:1.2.1:jar</value>
- </property>
- </properties>
-</library>
diff --git a/form.binding/src/org/netbeans/modules/form/binding/resources/layer.xml b/form.binding/src/org/netbeans/modules/form/binding/resources/layer.xml
deleted file mode 100644
index 016a77a..0000000
--- a/form.binding/src/org/netbeans/modules/form/binding/resources/layer.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
-<filesystem>
- <folder name="org-netbeans-api-project-libraries">
- <folder name="Libraries">
- <file name="beans_binding.xml" url="beans_binding.xml">
- <attr name="displayName" bundlevalue="org.netbeans.modules.form.binding.resources.Bundle#beans-binding"/>
- </file>
- </folder>
- </folder>
- <folder name="org-netbeans-modules-form">
- <folder name="classloader">
- <folder name="system">
- <file name="BindingSystemClasses.txt" url="BindingSystemClasses.txt" />
- </folder>
- </folder>
- </folder>
-</filesystem>
diff --git a/hibernate/build.xml b/hibernate/build.xml
deleted file mode 100644
index 66ff9c6..0000000
--- a/hibernate/build.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project basedir="." default="build" name="hibernate">
- <description>Builds, tests, and runs the project org.netbeans.modules.hibernate</description>
- <import file="../nbbuild/templates/projectized.xml"/>
-
- <property name="hibernate.resources.dir" value="./src/org/netbeans/modules/hibernate/resources/"/>
-
- <target name="build-init" depends="projectized.build-init">
- <unzip src="external/hibernate-external-resources.zip" dest="${hibernate.resources.dir}"/>
- </target>
-
-</project>
diff --git a/hibernate/external/binaries-list b/hibernate/external/binaries-list
deleted file mode 100644
index 0399374..0000000
--- a/hibernate/external/binaries-list
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-0FC3C79AA621E0A702748467200F464F0FF5EB7E hibernate-external-resources.zip
diff --git a/hibernate/external/hibernate-external-resources-license.txt b/hibernate/external/hibernate-external-resources-license.txt
deleted file mode 100644
index 4362b49..0000000
--- a/hibernate/external/hibernate-external-resources-license.txt
+++ /dev/null
@@ -1,502 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/hibernate/licenseinfo.xml b/hibernate/licenseinfo.xml
deleted file mode 100644
index b48ace1..0000000
--- a/hibernate/licenseinfo.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<licenseinfo>
- <fileset>
- <file>src/org/netbeans/modules/hibernate/hqleditor/ui/resources/run_hql_query_16.png</file>
- <file>src/org/netbeans/modules/hibernate/hqleditor/ui/resources/queryEditor16X16.png</file>
- <file>src/org/netbeans/modules/hibernate/resources/hibernate-mapping.png</file>
- <file>src/org/netbeans/modules/hibernate/resources/hibernate-configuration.png</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/columnIndex.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/column.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/columnView.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/columnPrimary.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/columnForeign.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/completion/table.gif</file>
- <file>src/org/netbeans/modules/hibernate/resources/hibernate-reveng.png</file>
- <license ref="Apache-2.0-ASF" />
- <comment type="COMMENT_UNSUPPORTED" />
- </fileset>
-</licenseinfo>
diff --git a/hibernate/manifest.mf b/hibernate/manifest.mf
deleted file mode 100644
index 9a2fd08..0000000
--- a/hibernate/manifest.mf
+++ /dev/null
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-OpenIDE-Module: org.netbeans.modules.hibernate/1
-OpenIDE-Module-Implementation-Version: 1
-OpenIDE-Module-Layer: org/netbeans/modules/hibernate/resources/layer.xml
-OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/hibernate/resources/Bundle.properties
diff --git a/hibernate/nbproject/project.properties b/hibernate/nbproject/project.properties
deleted file mode 100644
index 83b9fdc..0000000
--- a/hibernate/nbproject/project.properties
+++ /dev/null
@@ -1,41 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-build.compiler.deprecation=false
-javac.compilerargs=-Xlint -Xlint:-serial
-javac.source=1.8
-
-hibernate.test.dir=${nb_all}/contrib/hibernate/test
-
-spec.version.base=1.35.0
-
-test.unit.cp.extra=\
- ${nb_all}/libs.junit4/external/junit-4.12.jar:\
- ${hibernate.test.dir}/unit/data/db-derby-10.2.2.0-bin/lib/derbyclient.jar:\
- ${hibernate.test.dir}/unit/data/db-derby-10.2.2.0-bin/lib/derby.jar:\
- ${hibernate.test.dir}/unit/data/db-derby-10.2.2.0-bin/lib/derbytools.jar:\
- ${hibernate.test.dir}/unit/data/db-derby-10.2.2.0-bin/lib/derbynet.jar
-
-test.config.stableBTD.includes=**/*Test.class
-test.config.stableBTD.excludes=\
- **/HibernateCfgCompletionManagerTest.class,\
- **/HibernateCfgHyperlinkProviderTest.class,\
- **/HibernateEnvironmentTest.class,\
- **/HibernateMappingCompletionManagerTest.class,\
- **/HibernateMappingHyperlinkProviderTest.class
-
-requires.nb.javac=true
diff --git a/hibernate/nbproject/project.xml b/hibernate/nbproject/project.xml
deleted file mode 100644
index 0091f92..0000000
--- a/hibernate/nbproject/project.xml
+++ /dev/null
@@ -1,521 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<project xmlns="http://www.netbeans.org/ns/project/1">
- <type>org.netbeans.modules.apisupport.project</type>
- <configuration>
- <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
- <code-name-base>org.netbeans.modules.hibernate</code-name-base>
- <module-dependencies>
- <dependency>
- <code-name-base>org.netbeans.api.java</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.18</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.java.classpath</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.progress</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.40</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.progress.nb</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.40</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.xml</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.41</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.api.xml.ui</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.41</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.core.multiview</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.25</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.libs.javacapi</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>0.7</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.db</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.25</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.db.kit</code-name-base>
- <run-dependency>
- <specification-version>1.4</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.dbschema</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.editor</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>3</release-version>
- <specification-version>1.53</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.editor.completion</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.10</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.editor.document</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.editor.lib</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>3</release-version>
- <specification-version>4.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.editor.lib2</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>2.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.hibernate4lib</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.j2ee.core.utilities</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>0-1</release-version>
- <specification-version>1.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.j2ee.jpa.verification</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.j2ee.persistence</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.38.1</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.j2ee.persistence.kit</code-name-base>
- <run-dependency>
- <specification-version>1.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.kit</code-name-base>
- <run-dependency>
- <specification-version>1.4</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.project</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.62</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.project.ui</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.62</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.1</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.java.sourceui</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.5</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.lexer</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>2</release-version>
- <specification-version>1.64</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>9.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.project.ant</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.62</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.49</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.projectapi</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.23</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.78</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.projectuiapi.base</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.78</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.queries</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.11</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.refactoring.api</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.schema2beans</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.17</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.xml.catalog</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>2</release-version>
- <specification-version>2.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.xml.lexer</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>1.30</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.xml.multiview</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.7</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.netbeans.modules.xml.text</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <release-version>2</release-version>
- <specification-version>1.60</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.awt</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.dialogs</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.8</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.explorer</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>6.13</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.filesystems</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.loaders</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.61</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.modules</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.7</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.nodes</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>7.23</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.text</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>6.17</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util.lookup</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>8.0</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.util.ui</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>9.3</specification-version>
- </run-dependency>
- </dependency>
- <dependency>
- <code-name-base>org.openide.windows</code-name-base>
- <build-prerequisite/>
- <compile-dependency/>
- <run-dependency>
- <specification-version>6.19</specification-version>
- </run-dependency>
- </dependency>
- </module-dependencies>
- <test-dependencies>
- <test-type>
- <name>unit</name>
- <test-dependency>
- <code-name-base>org.netbeans.core.startup</code-name-base>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.netbeans.libs.junit4</code-name-base>
- <compile-dependency/>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.netbeans.modules.hibernate</code-name-base>
- <recursive/>
- <compile-dependency/>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.netbeans.modules.masterfs</code-name-base>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
- <recursive/>
- <compile-dependency/>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.openide.execution</code-name-base>
- </test-dependency>
- <test-dependency>
- <code-name-base>org.openide.options</code-name-base>
- <compile-dependency/>
- </test-dependency>
- </test-type>
- </test-dependencies>
- <friend-packages>
- <friend>org.netbeans.modules.hibernateweb</friend>
- <package>org.netbeans.modules.hibernate.cfg.model</package>
- <package>org.netbeans.modules.hibernate.loaders.cfg</package>
- <package>org.netbeans.modules.hibernate.service.api</package>
- <package>org.netbeans.modules.hibernate.spi.hibernate</package>
- <package>org.netbeans.modules.hibernate.wizards</package>
- </friend-packages>
- </data>
- </configuration>
-</project>
diff --git a/hibernate/src/org/netbeans/modules/hibernate/catalog/Bundle.properties b/hibernate/src/org/netbeans/modules/hibernate/catalog/Bundle.properties
deleted file mode 100644
index d1581cc..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/catalog/Bundle.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-LBL_HibernateCatalog=Hibernate Catalog
-LBL_HibernateCatalogDescription=Catalog for Hibernate XML DTDs
diff --git a/hibernate/src/org/netbeans/modules/hibernate/catalog/HibernateCatalog.java b/hibernate/src/org/netbeans/modules/hibernate/catalog/HibernateCatalog.java
deleted file mode 100644
index 5afd6b1..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/catalog/HibernateCatalog.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.catalog;
-
-import java.beans.PropertyChangeListener;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.netbeans.modules.xml.catalog.spi.CatalogDescriptor2;
-import org.netbeans.modules.xml.catalog.spi.CatalogListener;
-import org.netbeans.modules.xml.catalog.spi.CatalogReader;
-import org.openide.util.NbBundle;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This class registers Hibernate specific DTDs in the NetBeans DTD and Schema
- * catalog.
- *
- * @author Vadiraj Deshpande (Vadiraj.Deshpande@Sun.COM)
- */
-public class HibernateCatalog implements CatalogReader, CatalogDescriptor2,
- EntityResolver{
-
- private String CONFIG_PUBLIC_ID = "-//Hibernate/Hibernate Configuration DTD 3.0//EN"; //NOI18N
- private String CONFIG_DTD = "hibernate-configuration-3.0.dtd"; //NOI18N
- private String CONFIG = "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"; //NOI18N
- private String CONFIG_DTD_URL = "nbres:/org/netbeans/modules/hibernate/resources/" + CONFIG_DTD; //NOI18N
-
- private String MAPPING_PUBLIC_ID = "-//Hibernate/Hibernate Mapping DTD 3.0//EN"; //NOI18N
- private String MAPPING_DTD = "hibernate-mapping-3.0.dtd"; //NOI18N
- private String MAPPING = "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"; //NOI18N
- private String MAPPING_DTD_URL = "nbres:/org/netbeans/modules/hibernate/resources/" + MAPPING_DTD; //NOI18N
-
- private String REVERSE_ENG_PUBLIC_ID = "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"; //NOI18N
- private String REVERSE_ENG_DTD = "hibernate-reverse-engineering-3.0.dtd"; //NOI18N
- private String REVERSE_ENG = "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"; //NOI18N
- private String REVERSE_ENG_DTD_URL = "nbres:/org/netbeans/modules/hibernate/resources/" + REVERSE_ENG_DTD; //NOI18N
-
- public Iterator getPublicIDs() {
- List<String> publicIdList = new ArrayList<String>();
- publicIdList.add(CONFIG_PUBLIC_ID);
- publicIdList.add(MAPPING_PUBLIC_ID);
- publicIdList.add(REVERSE_ENG_PUBLIC_ID);
-
- return publicIdList.listIterator();
- }
-
- public void refresh() {
- //TODO Investigate the necessity of this implementation.
- }
-
- public String getSystemID(String publicId) {
-
- if(CONFIG_PUBLIC_ID.equals(publicId)) {
- return CONFIG_DTD_URL;
- } else if(MAPPING_PUBLIC_ID.equals(publicId)) {
- return MAPPING_DTD_URL;
- } else if(REVERSE_ENG_PUBLIC_ID.equals(publicId)) {
- return REVERSE_ENG_DTD_URL;
- }
-
- return null;
- }
-
- public String resolveURI(String name) {
- return null;
- }
-
- public String resolvePublic(String publicId) {
- return null;
- }
-
- public void addCatalogListener(CatalogListener l) {
-
- }
-
- public void removeCatalogListener(CatalogListener l) {
-
- }
-
- public String getIconResource(int type) {
- return "org/netbeans/modules/hibernate/resources/hibernate-configuration.png"; //NOI18N
- }
-
- public String getDisplayName() {
- return NbBundle.getMessage(HibernateCatalog.class, "LBL_HibernateCatalog"); //NOI18N
- }
-
- public String getShortDescription() {
- return NbBundle.getMessage(HibernateCatalog.class, "LBL_HibernateCatalogDescription"); //NOI18N
- }
-
- public void addPropertyChangeListener(PropertyChangeListener l) {
-
- }
-
- public void removePropertyChangeListener(PropertyChangeListener l) {
-
- }
-
- public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
- if (CONFIG_PUBLIC_ID.equals(publicId)) {
- return new org.xml.sax.InputSource(CONFIG_DTD_URL);
- } else if(MAPPING_PUBLIC_ID.equals(publicId)) {
- return new org.xml.sax.InputSource(MAPPING_DTD_URL);
- } else if(REVERSE_ENG_PUBLIC_ID.equals(publicId)) {
- return new org.xml.sax.InputSource(REVERSE_ENG_DTD_URL);
- }
-
- return null;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/cfg/Bundle.properties b/hibernate/src/org/netbeans/modules/hibernate/cfg/Bundle.properties
deleted file mode 100644
index ad07414..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/cfg/Bundle.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#HibernateCfgProperties
-LBL_CustomClass=--Enter custom class--
diff --git a/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgProperties.java b/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgProperties.java
deleted file mode 100644
index 2aba844..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgProperties.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.cfg;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.hibernate.cfg.Environment;
-import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory;
-import org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory;
-import org.openide.util.NbBundle;
-
-/**
- * This class contains all the properties in the Hibernate configuration file
- *
- * @author Dongmei Cao
- */
-public class HibernateCfgProperties {
-
- public static final String[] dialects = new String[]{
- "org.hibernate.dialect.DB2Dialect", //NOI18N
- "org.hibernate.dialect.DB2390Dialect", //NOI18N
- "org.hibernate.dialect.DB2400Dialect", //NOI18N
- "org.hibernate.dialect.DerbyDialect", //NOI18N
- "org.hibernate.dialect.FirebirdDialect", //NOI18N
- "org.hibernate.dialect.FrontbaseDialect", //NOI18N
- "org.hibernate.dialect.HSQLDialect", //NOI18N
- "org.hibernate.dialect.InformixDialect", //NOI18N
- "org.hibernate.dialect.IngresDialect", //NOI18N
- "org.hibernate.dialect.InterbaseDialect", //NOI18N
- "org.hibernate.dialect.MckoiDialect", //NOI18N
- "org.hibernate.dialect.MySQLDialect", //NOI18N
- "org.hibernate.dialect.MySQLInnoDBDialect", //NOI18N
- "org.hibernate.dialect.MySQLMyISAMDialect", //NOI18N
- "org.hibernate.dialect.OracleDialect", //NOI18N
- "org.hibernate.dialect.Oracle9Dialect", //NOI18N
- "org.hibernate.dialect.PointbaseDialect", //NOI18N
- "org.hibernate.dialect.PostgreSQLDialect", //NOI18N
- "org.hibernate.dialect.ProgressDialect", //NOI18N
- "org.hibernate.dialect.SAPDBDialect", //NOI18N
- "org.hibernate.dialect.SQLServerDialect", //NOI18N
- "org.hibernate.dialect.SybaseDialect", //NOI18N
- "org.hibernate.dialect.SybaseAnywhereDialect" //NOI18N
- };
-
- public static String[] driverClassess = new String[]{
- "com.ibm.db2.jdbc.app.DB2Driver", //NOI18N
- "com.informix.jdbc.IfxDriver", //NOI18N
- "com.mckoi.JDBCDriver", //NOI18N
- "com.mysql.jdbc.Driver", //NOI18N
- "com.pointbase.jdbc.jdbcUniversalDriver", //NOI18N
- "com.sun.sql.jdbc.sqlserver.SQLServerDriver", //NOI18N
- "com.sun.sql.jdbc.sybase.SybaseDriver", //NOI18N
- "interbase.interclient.Driver", //NOI18N
- "oracle.jdbc.driver.OracleDriver", //NOI18N
- "oracle.jdbc.OracleDriver", //NOI18N
- "org.apache.derby.jdbc.ClientDriver", //NOI18N
- "org.firebirdsql.jdbc.FBDriver", //NOI18N
- "org.hsqldb.jdbcDriver", //NOI18N
- "org.postgresql.Driver" //NOI18N
- };
-
- public final static String[] jdbcProps = new String[] {
- Environment.DRIVER,
- Environment.URL,
- Environment.USER,
- Environment.PASS,
- Environment.POOL_SIZE
- };
-
- public final static String[] datasourceProps = new String[] {
- Environment.DATASOURCE,
- Environment.JNDI_URL,
- Environment.JNDI_CLASS,
- Environment.USER,
- Environment.PASS
- };
-
- public final static String[] optionalConfigProps = new String[] {
- Environment.DIALECT,
- Environment.SHOW_SQL,
- Environment.FORMAT_SQL,
- Environment.DEFAULT_SCHEMA,
- Environment.DEFAULT_CATALOG,
- Environment.SESSION_FACTORY_NAME,
- Environment.MAX_FETCH_DEPTH,
- Environment.DEFAULT_BATCH_FETCH_SIZE,
- Environment.DEFAULT_ENTITY_MODE,
- Environment.ORDER_UPDATES,
- Environment.GENERATE_STATISTICS,
- Environment.USE_IDENTIFIER_ROLLBACK,
- Environment.USE_SQL_COMMENTS
- };
-
- public final static String[] optionalJdbcConnProps = new String[] {
- Environment.STATEMENT_FETCH_SIZE,
- Environment.STATEMENT_BATCH_SIZE,
- Environment.BATCH_VERSIONED_DATA,
- Environment.BATCH_STRATEGY,
- Environment.USE_SCROLLABLE_RESULTSET,
- Environment.USE_STREAMS_FOR_BINARY,
- Environment.USE_GET_GENERATED_KEYS,
- Environment.CONNECTION_PROVIDER,
- Environment.ISOLATION,
- Environment.AUTOCOMMIT,
- Environment.RELEASE_CONNECTIONS
- };
-
- public final static String[] optionalCacheProps = new String[] {
-// Environment.CACHE_PROVIDER,
- Environment.USE_MINIMAL_PUTS,
- Environment.USE_QUERY_CACHE,
- Environment.USE_SECOND_LEVEL_CACHE,
- Environment.QUERY_CACHE_FACTORY,
- Environment.CACHE_REGION_PREFIX,
- Environment.USE_STRUCTURED_CACHE
- };
-
- public final static String[] optionalTransactionProps = new String[] {
- Environment.TRANSACTION_STRATEGY,
-// Environment.USER_TRANSACTION,
-// Environment.TRANSACTION_MANAGER_STRATEGY,
- Environment.FLUSH_BEFORE_COMPLETION,
- Environment.AUTO_CLOSE_SESSION
- };
-
- public final static String[] optionalMiscProps = new String[] {
- Environment.CURRENT_SESSION_CONTEXT_CLASS,
- Environment.QUERY_TRANSLATOR,
- Environment.QUERY_SUBSTITUTIONS,
- Environment.HBM2DDL_AUTO,
- Environment.USE_REFLECTION_OPTIMIZER
- };
-
- // A map to hint the possible values for all the Hibernate properties:
- // null for no hint
- // String[] for selecting one of the values
- private final static String[] TRUE_FALSE = new String[] {"true", "false" }; // NOI18N
- private final static String[] RELEASE_MODES = new String[] {"auto", "on_close", "after_transaction", "after_statement"}; // NOI18N
- private final static String[] SESSION_CONTEXT = new String[] {"jta", "thread", "managed", NbBundle.getMessage(HibernateCfgProperties.class, "LBL_CustomClass")}; // NOI18N
- private final static String[] QUERY_FACTORY_CLASS = new String[] {ASTQueryTranslatorFactory.class.getName(),
- ClassicQueryTranslatorFactory.class.getName()}; // NOI18N
- private final static String[] HBM2DDL_AUTO = new String[] {"validate", "update", "create", "create-drop" }; // NOI18N
-
- private static Map<String, Object> possiblePropertyValues = new HashMap<String, Object>();
- static {
- possiblePropertyValues.put(Environment.DRIVER, driverClassess);
- possiblePropertyValues.put(Environment.URL, null);
- possiblePropertyValues.put(Environment.USER, null);
- possiblePropertyValues.put(Environment.PASS, null);
- possiblePropertyValues.put(Environment.POOL_SIZE, null);
-
- possiblePropertyValues.put(Environment.DATASOURCE, null);
- possiblePropertyValues.put(Environment.JNDI_URL, null);
- possiblePropertyValues.put(Environment.JNDI_CLASS, null);
- possiblePropertyValues.put(Environment.USER, null);
- possiblePropertyValues.put(Environment.PASS, null);
-
- possiblePropertyValues.put(Environment.DIALECT, dialects);
- possiblePropertyValues.put(Environment.SHOW_SQL, TRUE_FALSE);
- possiblePropertyValues.put(Environment.FORMAT_SQL, TRUE_FALSE);
- possiblePropertyValues.put(Environment.DEFAULT_SCHEMA, null);
- possiblePropertyValues.put(Environment.DEFAULT_CATALOG, null);
- possiblePropertyValues.put(Environment.SESSION_FACTORY_NAME, null);
- possiblePropertyValues.put(Environment.MAX_FETCH_DEPTH, null);
- possiblePropertyValues.put(Environment.DEFAULT_BATCH_FETCH_SIZE, null);
- possiblePropertyValues.put(Environment.DEFAULT_ENTITY_MODE, null);
- possiblePropertyValues.put(Environment.ORDER_UPDATES, TRUE_FALSE);
- possiblePropertyValues.put(Environment.GENERATE_STATISTICS, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_IDENTIFIER_ROLLBACK, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_SQL_COMMENTS, TRUE_FALSE);
-
- possiblePropertyValues.put(Environment.STATEMENT_FETCH_SIZE, null);
- possiblePropertyValues.put(Environment.STATEMENT_BATCH_SIZE, null);
- possiblePropertyValues.put(Environment.BATCH_VERSIONED_DATA, TRUE_FALSE);
- possiblePropertyValues.put(Environment.BATCH_STRATEGY, null );
- possiblePropertyValues.put(Environment.USE_SCROLLABLE_RESULTSET, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_STREAMS_FOR_BINARY, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_GET_GENERATED_KEYS, TRUE_FALSE);
- possiblePropertyValues.put(Environment.CONNECTION_PROVIDER, null);
- possiblePropertyValues.put(Environment.ISOLATION, null);
- possiblePropertyValues.put(Environment.AUTOCOMMIT, TRUE_FALSE);
- possiblePropertyValues.put(Environment.RELEASE_CONNECTIONS, RELEASE_MODES );
-
-// possiblePropertyValues.put(Environment.CACHE_PROVIDER, null);
- possiblePropertyValues.put(Environment.USE_MINIMAL_PUTS, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_QUERY_CACHE, TRUE_FALSE);
- possiblePropertyValues.put(Environment.USE_SECOND_LEVEL_CACHE, TRUE_FALSE);
- possiblePropertyValues.put(Environment.QUERY_CACHE_FACTORY, null);
- possiblePropertyValues.put(Environment.CACHE_REGION_PREFIX, null);
- possiblePropertyValues.put(Environment.USE_STRUCTURED_CACHE, TRUE_FALSE);
-
- possiblePropertyValues.put(Environment.TRANSACTION_STRATEGY, null);
-// possiblePropertyValues.put(Environment.USER_TRANSACTION, null);
-// possiblePropertyValues.put(Environment.TRANSACTION_MANAGER_STRATEGY, null);
- possiblePropertyValues.put(Environment.FLUSH_BEFORE_COMPLETION, TRUE_FALSE);
- possiblePropertyValues.put(Environment.AUTO_CLOSE_SESSION, TRUE_FALSE);
-
- possiblePropertyValues.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SESSION_CONTEXT);
- possiblePropertyValues.put(Environment.QUERY_TRANSLATOR, QUERY_FACTORY_CLASS);
- possiblePropertyValues.put(Environment.QUERY_SUBSTITUTIONS, null);
- possiblePropertyValues.put(Environment.HBM2DDL_AUTO, HBM2DDL_AUTO);
- possiblePropertyValues.put(Environment.USE_REFLECTION_OPTIMIZER, TRUE_FALSE);
- };
-
- public static Object getPossiblePropertyValue( String propName ) {
- return possiblePropertyValues.get( propName );
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgXmlConstants.java b/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgXmlConstants.java
deleted file mode 100644
index 63febd3..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/cfg/HibernateCfgXmlConstants.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.cfg;
-
-/**
- * Constants for Hibernate configuration file tags and attribute names
- *
- * @author Dongmei Cao
- */
-public class HibernateCfgXmlConstants {
-
- public static final String PROPERTY_TAG = "property";
- public static final String MAPPING_TAG = "mapping";
- public static final String CLASS_CACHE_TAG = "class-cache";
- public static final String COLLECTION_CACHE_TAG = "collection-cache";
- public static final String LISTENER_TAG = "listener";
-
- public static final String RESOURCE_ATTRIB = "resource";
- public static final String NAME_ATTRIB = "name";
- public static final String CLASS_ATTRIB = "class";
- public static final String COLLECTION_ATTRIB = "collection";
- public static final String PACKAGE_ATTRIB = "package";
-
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/cfg/model/package-info.java b/hibernate/src/org/netbeans/modules/hibernate/cfg/model/package-info.java
deleted file mode 100644
index 8514c8c..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/cfg/model/package-info.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-@Schema2Beans(
- schema="../../resources/hibernate-configuration-3.0.dtd",
- schemaType=SchemaType.DTD,
- mddFile="../../resources/hibernate-configuration-3.0.mdd",
- outputType=OutputType.TRADITIONAL_BASEBEAN,
- validate=false,
- removeUnreferencedNodes=true,
- java5=true
-)
-package org.netbeans.modules.hibernate.cfg.model;
-
-import org.netbeans.modules.schema2beans.Schema2Beans;
-import org.netbeans.modules.schema2beans.Schema2Beans.OutputType;
-import org.netbeans.modules.schema2beans.Schema2Beans.SchemaType;
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/Bundle.properties b/hibernate/src/org/netbeans/modules/hibernate/completion/Bundle.properties
deleted file mode 100644
index cbe7549..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/Bundle.properties
+++ /dev/null
@@ -1,177 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#Generator classes
-INCREMENT_GENERATOR_DESC=Generates identifiers of type <code>long</code>, <code>short</code> \
-or <code>int</code> that are unique only when no other process is inserting data into the \
-same table. Do not use in a cluster.
-IDENTITY_GENERATOR_DESC=Supports identify columns in DB2, MySQL, MS SQL Server, Sybase and \
-HypersonicSQL. The returned identifier is of type <code>long</code>, <code>short</code> or <code>int</code>.
-SEQUENCE_GENERATOR_DESC=Uses a sequence in DB2, PostgreSQL, Oracle, SAP DB, McKoi or a generator in Interbase. \
-The returned identifier is of type <code>long</code>, <code>short</code> or <code>int</code>.
-HILO_GENERATOR_DESC=Uses a hi/lo algorithm to efficiently generate identifiers of type \
-<code>long</code>, <code>short</code> or <code>int</code>, given a table and column (by default \
-<code>hibernate_unique_key</code> and <code>next_hi</code> respectively) as a source of hi values. \
-The hi/lo algorithm generates identifiers that are unique only for a particular database.
-SEQHILO_GENERATOR_DESC=Uses a hi/lo algorithm to efficiently generate identifiers of type \
-<code>long</code>, <code>short</code> or <code>int</code>, given a named database sequence.
-UUID_GENERATOR_DESC=Uses a 128-bit UUID algorithm to generate identifiers of type string, unique \
-within a network (the IP address is used). The UUID is encoded as a string of hexadecimal digits of length 32.
-GUID_GENERATOR_DESC=Uses a database-generated GUID string on MS SQL Server and MySQL.
-NATIVE_GENERATOR_DESC=Picks <code>identity</code>, <code>sequence</code> or <code>hilo</code> depending upon \
-the capabilities of the underlying database.
-ASSIGNED_GENERATOR_DESC=Allows the application assign an identifier to the object before save() is called. \
-This is the default strategy if no <generator> element is specified.
-SELECT_GENERATOR_DESC=Retrieves a primary key assigned by a database trigger by selecting the row \
-by some unique key and retrieving the primary key value.
-FOREIGN_GENERATOR_DESC=Uses the identifier of another associated object. Usually used in conjunction \
-with a <one-to-one> primary key association.
-SEQUENCE_IDENTITY_GENERATOR_DESC=A specialized sequence generation strategy which utilizes a database \
-sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to actually \
-return the generated identifier value as part of the insert statement execution. \
-This strategy is only known to be supported on Oracle 10g drivers targeted for JDK 1.4. \
-Note comments on these insert statements are disabled due to a bug in the Oracle drivers.
-
-#Hibernate types
-BIG_DECIMAL_DESC=Type mapping from <code>java.math.BigDecimal</code> to <code>NUMERIC</code> (or Oracle <code>NUMBER</code>).
-BIG_INTEGER_DESC=Type mapping from <code>java.math.Biginteger</code> to <code>NUMERIC</code> (or Oracle <code>NUMBER</code>).
-BINARY_DESC=Type mapping from <code>byte[]</code> to an appropriate SQL binary type.
-BLOB_DESC=Type mapping for the JDBC class <code>java.sql.Blob</code>.
-BOOLEAN_DESC=Type mapping from <code>boolean</code> or <code>java.lang.Boolean</code> to an appropriate (vendor-specific) SQL column type.
-BYTE_DESC=Type mapping from <code>byte</code> or <code>java.lang.Byte</code> to an appropriate (vendor-specific) SQL column type.
-CALENDAR_DESC=Type mapping from <code>java.util.Calendar</code> to SQL type <code>TIMESTAMP</code> (or equivalent).
-CALENDAR_DATE_DESC=Type mapping from <code>java.util.Calendar</code> to SQL type <code>DATE</code> (or equivalent).
-CHARACTER_DESC=Type mapping <code>char</code> or <code>java.lang.Character</code> to an appropriate (vendor-specific) SQL column type.
-CLASS_DESC=Type mapping <code>java.lang.Class</code> to <code>VARCHAR</code> (or Oracle <code>VARCHAR2</code>). A <code>Class</code> \
-is mapped to its fully qualified name.
-CLOB_DESC=Type mapping for the JDBC class <code>java.sql.Clob</code>.
-CURRENCY_DESC=Type mapping from <code>java.util.Currency</code> to <code>VARCHAR</code> (or Oracle <code>VARCHAR2</code>). Instances of \
-<code>Currency</code> are mapped to their ISO codes.
-DATE_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>DATE</code> (or equivalent).
-DOUBLE_DESC=Type mapping from <code>double</code> or <code>java.lang.Double</code> to an appropriate (vendor-specific) SQL column type.
-FLOAT_DESC=Type mapping from <code>float</code> or <code>java.lang.Float</code> to an appropriate (vendor-specific) SQL column type.
-IMM_BINARY_DESC=Type mapping for <code>byte[]</code>, where Hibernate treats the object as immutable.
-IMM_CALENDAR_DESC=Type mapping from <code>java.util.Calendar</code> to SQL type <code>TIMESTAMP</code> (or equivalent), \
-where Hibernate treats the object as immutable.
-IMM_CALENDAR_DATE_DESC=Type mapping from <code>java.util.Calendar</code> to SQL type <code>DATE</code> (or equivalent), \
-where Hibernate treats the object as immutable.
-IMM_DATE_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>DATE</code> (or equivalent), \
-where Hibernate treats the object as immutable.
-IMM_SERIALIZABLE_DESC=Type mapping from serializable Java types to an appropriate SQL binary type, where Hibernate treats the object as immutable.
-IMM_TIME_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>TIME</code> (or equivalent), \
-where Hibernate treats the object as immutable.
-IMM_TIMESTAMP_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>TIMESTAMP</code> (or equivalent), \
-where Hibernate treats the object as immutable.
-INTEGER_DESC=Type mapping from <code>int</code> or <code>java.lang.Integer</code> to an appropriate (vendor-specific) SQL column type.
-#INTEGER_DESC=<b>Java type:</b> <code>int</code> or <code>java.lang.Integer</code> <br> <b>Standard SQL built-in type:</b> <code>INTEGER</code>
-LOCALE_DESC=Type mapping from <code>java.util.Locale</code> to <code>VARCHAR</code> (or Oracle <code>VARCHAR2</code>). \
-Instances of Locale are mapped to their ISO codes.
-LONG_DESC=Type mapping from <code>long</code> or <code>java.lang.Long</code> to an appropriate (vendor-specific) SQL column type.
-SERIALIZABLE_DESC=Type mapping serializable Java types to an appropriate SQL binary type.
-SHORT_DESC=Type mapping from <code>short</code> or <code>java.lang.Short</code> to an appropriate (vendor-specific) SQL column type.
-STRING_DESC=Type mapping from <code>java.lang.String</code> to <code>VARCHAR</code> (or Oracle <code>VARCHAR2</code>).
-TEXT_DESC=Type mapping from long Java strings to a SQL <code>CLOB</code> or <code>TEXT</code> type.
-TIME_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>TIME</code> (or equivalent).
-TIMESTAMP_DESC=Type mapping from <code>java.util.Date</code> and its subclasses to SQL type <code>TIMESTAMP</code> (or equivalent).
-TIMEZONE_DESC=Type mapping from <code>java.util.TimeZone</code> to <code>VARCHAR</code> (or Oracle <code>VARCHAR2</code>). \
-Instances of <code>TimeZone</code> are mapped to their ID.
-TRUE_FALSE_DESC=An alternative encoding for a Java <code>boolean</code> or <code>java.lang.Boolean</code>.
-YES_NO_DESC=An alternative encoding for a Java <code>boolean</code> or <code>java.lang.Boolean</code>.
-
-# Hibernate configuration properties
-AUTOCOMMIT_DESC=JDBC autocommit mode.
-AUTO_CLOSE_SESSION_DESC=Enable automatic session close at end of transaction.
-BYTECODE_PROVIDER_DESC=Specifies the bytecode provider to use to optimize the use of reflection in Hibernate.
-BATCH_STRATEGY_DESC=Select a custom batcher.
-BATCH_VERSIONED_DATA_DESC=Include versioned data in batching?
-C3P0_ACQUIRE_INCREMENT_DESC=Number of connections acquired when pool is exhausted.
-C3P0_IDLE_TEST_PERIOD_DESC=Idle time before a C3P0 pooled connection is validated.
-C3P0_MAX_SIZE_DESC=Maximum size of C3P0 connection pool.
-C3P0_MAX_STATEMENTS_DESC=Maximum size of C3P0 statement cache.
-C3P0_MIN_SIZE_DESC=Minimum size of C3P0 connection pool.
-C3P0_TIMEOUT_DESC=Maximum idle time for C3P0 connection pool.
-CACHE_PROVIDER_DESC=The <code>CacheProvider</code> implementation class.
-CACHE_REGION_PREFIX_DESC=The <code>CacheProvider</code> region name prefix.
-CACHE_PROVIDER_CONFIG_DESC=The <code>CacheProvider</code> implementation class.
-CACHE_NAMESPACE_DESC=The <code>CacheProvider</code> JNDI namespace, if pre-bound to JNDI.
-CONNECTION_PROVIDER_DESC=The <code>ConnectionProvider</code> implementor to use when obtaining connections.
-CONNECTION_PREFIX_DESC=The prefix for arbitrary JDBC connection properties.
-CURRENT_SESSION_CONTEXT_CLASS_DESC=Context scoping impl for <code>SessionFactory.getCurrentSession()</code> processing.
-DATASOURCE_DESC=<code>java.sql.Datasource</code> JNDI name.
-DEFAULT_BATCH_FETCH_SIZE_DESC=The default batch size for batch fetching.
-DEFAULT_CATALOG_DESC=A default database catalog name to use for unqualified table names.
-DEFAULT_ENTITY_MODE_DESC=The EntityMode in which set the Session opened from the SessionFactory.
-DEFAULT_SCHEMA_DESC=A default database schema (owner) name to use for unqualified table names.
-DIALECT_DESC=Hibernate SQL <code>Dialect</code> class.
-DRIVER_DESC=JDBC driver class.
-FLUSH_BEFORE_COMPLETION_DESC=Enable automatic flush during the JTA <code>beforeCompletion()</code> callback.
-FORMAT_SQL_DESC=Enable formatting of SQL logged to the console.
-GENERATE_STATISTICS_DESC=Enable statistics collection.
-HBM2DDL_AUTO_DESC=Auto export/update schema using hbm2ddl tool. Valid values are <code>update</code>, \
-<code>create</code>, <code>create-drop</code> and <code>validate</code>.
-ISOLATION_DESC=JDBC transaction isolation level.
-JACC_CONTEXTID_DESC=The jacc context id of the deployment.
-JNDI_CLASS_DESC=JNDI initial context class, <code>Context.INITIAL_CONTEXT_FACTORY</code>.
-JNDI_URL_DESC=JNDI provider URL, <code>Context.PROVIDER_URL</code>.
-JPAQL_STRICT_COMPLIANCE_DESC=Compliance to JAP QL.
-MAX_FETCH_DEPTH_DESC=Maximum depth of outer join fetching.
-ORDER_UPDATES_DESC=Enable ordering of update statements by primary key value.
-OUTPUT_STYLESHEET_DESC=An XSLT resource used to generate "custom" XML.
-PASS_DESC=JDBC password.
-POOL_SIZE_DESC=Maximum number of inactive connections for Hibernate's connection pool.
-PROXOOL_EXISTING_POOL_DESC=Proxool property to configure the Proxool Provider from an already \
-existing pool (<code>true/false</code>).
-PROXOOL_POOL_ALIAS_DESC=Proxool property with the Proxool pool alias to use (Required for \
-<code>PROXOOL_EXISTING_POOL</code>, <code>PROXOOL_PROPERTIES</code>, or <code>PROXOOL_XML</code>).
-PROXOOL_PREFIX_DESC=Proxool/Hibernate property prefix.
-PROXOOL_PROPERTIES_DESC=Proxool property to configure the Proxool Provider using a properties file \
-(<code>/path/to/proxool.properties</code>).
-PROXOOL_XML_DESC=Proxool property to configure the Proxool Provider using an XML (<code>/path/to/file.xml</code>).
-QUERY_CACHE_FACTORY_DESC=The <code>QueryCacheFactory</code> implementation class.
-QUERY_TRANSLATOR_DESC=The classname of the HQL query parser factory.
-QUERY_SUBSTITUTIONS_DESC=A comma-separated list of token substitutions to use when translating a Hibernate query to SQL.
-QUERY_STARTUP_CHECKING_DESC=Check named queries during startup (enabled by default). \
-Mainly intended for test environments.
-RELEASE_CONNECTIONS_DESC=Specifies how Hibernate should release JDBC connections.
-SESSION_FACTORY_NAME_DESC=JNDI name to bind to <code>SessionFactory</code>.
-SHOW_SQL_DESC=Enable logging of generated SQL to the console.
-SQL_EXCEPTION_CONVERTER_DESC=The <code>SQLExceptionConverter</code> to use for converting SQLExceptions to \
-Hibernate's <code>JDBCException</code> hierarchy. \
-The default is to use the configured Dialect's preferred <code>SQLExceptionConverter</code>.
-STATEMENT_BATCH_SIZE_DESC=Maximum JDBC batch size. A nonzero value enables batch updates.
-STATEMENT_FETCH_SIZE_DESC=Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. \
-If 0, JDBC driver default settings will be used.
-TRANSACTION_STRATEGY_DESC=<code>TransactionFactory</code> implementor to use for creating <code>Transactions</code>.
-TRANSACTION_MANAGER_STRATEGY_DESC=<code>TransactionManagerLookup</code> implementor to use for obtaining the <code>TransactionManager</code>.
-URL_DESC=JDBC URL.
-USER_DESC=JDBC user.
-USE_GET_GENERATED_KEYS_DESC=Tells the JDBC driver to attempt to retrieve row Id with the JDBC 3.0 \
-<code>PreparedStatement.getGeneratedKeys()</code> method. In general, performance will be better if this property \
-is set to true and the underlying JDBC driver supports getGeneratedKeys().
-USE_SCROLLABLE_RESULTSET_DESC=Use JDBC scrollable ResultSets. This property is only necessary when there is no ConnectionProvider, \
-i.e. the user is supplying JDBC connections.
-USE_STREAMS_FOR_BINARY_DESC=Use java.io streams to read/write binary data from/to JDBC.
-USE_IDENTIFIER_ROLLBACK_DESC=Determines whether Hibernate uses identifier rollback.
-USE_SQL_COMMENTS_DESC=Add comments to the generated SQL.
-USE_MINIMAL_PUTS_DESC=Optimize the cache for minimal puts instead of minimal gets.
-USE_QUERY_CACHE_DESC=Enable the query cache (disabled by default).
-USE_SECOND_LEVEL_CACHE_DESC=Enable the second-level cache (enabled by default).
-USE_STRUCTURED_CACHE_DESC=Enable use of structured second-level cache entries.
-USER_TRANSACTION_DESC=JNDI name of JTA <code>UserTransaction</code> object.
-USE_REFLECTION_OPTIMIZER_DESC=Use bytecode libraries optimized property access.
-WRAP_RESULT_SETS_DESC=Enable wrapping of JDBC result sets in order to speed up column name lookups for broken JDBC drivers.
-
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/CompletionContext.java b/hibernate/src/org/netbeans/modules/hibernate/completion/CompletionContext.java
deleted file mode 100644
index 2810ef7..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/CompletionContext.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.EditorContextFactory;
-import org.netbeans.modules.hibernate.editor.DocumentContext;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.lexer.TokenSequence;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-import org.netbeans.modules.xml.text.api.dom.SyntaxElement;
-import org.netbeans.modules.xml.text.api.dom.XMLSyntaxSupport;
-import org.openide.util.Exceptions;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-/**
- * Tracks context information for a code completion scenario
- *
- * @author Rohan Ranade (Rohan.Ranade@Sun.COM)
- */
-public class CompletionContext {
- private List<String> existingAttributes = Collections.emptyList();
-
- public static enum CompletionType {
- TAG,
- VALUE,
- ATTRIBUTE,
- ATTRIBUTE_VALUE,
- NONE
- };
-
- private static final Logger LOGGER = Logger.getLogger(CompletionContext.class.getName());
- private CompletionType completionType = CompletionType.NONE;
- private Document doc;
- private int caretOffset;
- private DocumentContext documentContext;
- private String typedChars = "";
- private char lastTypedChar;
- private XMLSyntaxSupport support;
-
- public CompletionContext(Document doc, int caretOffset) {
- this.doc = doc;
- this.caretOffset = caretOffset;
-
- try {
- this.support = XMLSyntaxSupport.getSyntaxSupport(doc);
- } catch (ClassCastException cce) {
- LOGGER.log(Level.FINE, cce.getMessage());
- this.support = XMLSyntaxSupport.createSyntaxSupport(doc);
- }
- this.documentContext = EditorContextFactory.getDocumentContext(doc, caretOffset);
- this.lastTypedChar = support.lastTypedChar();
- try {
- initContext();
- } catch (BadLocationException ex) {
- // ignore
- }
- }
-
- private void initContext() throws BadLocationException {
- Token<XMLTokenId> token = documentContext.getCurrentToken();
- if(token == null)
- return;
-
- boolean tokenBoundary = (documentContext.getCurrentTokenOffset() == caretOffset)
- || ((documentContext.getCurrentTokenOffset() + token.length()) == caretOffset);
-
- XMLTokenId id = token.id();
- SyntaxElement element = documentContext.getCurrentElement();
- String chars = token.text().toString().trim();
- int tOffset = documentContext.getCurrentTokenOffset();
- switch (id) {
- //user enters < character
- case TEXT:
- Token<XMLTokenId> previousTokenItem = support.getPreviousToken(tOffset);
- if (previousTokenItem == null) {
- completionType = CompletionType.NONE;
- break;
- }
- String text = previousTokenItem.text().toString().trim();
- if (chars != null && chars.equals("") &&
- text.equals("/>")) { // NOI18N
- completionType = CompletionType.NONE;
- break;
- }
- if (chars != null && chars.equals("") &&
- text.equals(">")) { // NOI18N
- completionType = CompletionType.VALUE;
- break;
- }
- if (chars != null && !chars.startsWith("<") &&
- text.equals(">")) { // NOI18N
-
- completionType = CompletionType.VALUE;
- typedChars = "";
- break;
- }
- if (chars != null && !chars.equals("<") &&
- text.equals(">")) { // NOI18N
- completionType = CompletionType.NONE;
- break;
- }
- if (chars != null && chars.startsWith("<")) { // NOI18N
- typedChars = chars.substring(1);
- }
- completionType = CompletionType.TAG;
- break;
-
- //start tag of an element
- case TAG:
- String tagName = element.getNode().getNodeName();
- if (support.isEndTag(element)) {
- completionType = CompletionType.NONE;
- break;
- }
- if (support.isEmptyTag(element)) {
- if (token != null &&
- chars.equals("/>")) {
- completionType = CompletionType.NONE;
- break;
- }
- if (element.getElementOffset() + 1 == this.caretOffset) {
- completionType = CompletionType.TAG;
- break;
- }
- if (caretOffset > element.getElementOffset() + 1 &&
- caretOffset <= element.getElementOffset() + 1 +tagName.length()) {
- completionType = CompletionType.TAG;
- typedChars = tagName;
- break;
- }
- completionType = CompletionType.ATTRIBUTE;
- break;
- }
-
- if (support.isStartTag(element)) {
- if (token != null &&
- chars.equals(">")) {
- completionType = CompletionType.NONE;
- break;
- }
- if (token != null &&
- chars.startsWith("</")) {
- typedChars = "";
- completionType = CompletionType.VALUE;
- break;
- }
- if (element.getElementOffset() + 1 != this.caretOffset) {
- typedChars = tagName;
- }
- }
-
- if (element instanceof Text) {
- if (token != null &&
- chars.startsWith("</")) {
- Token<XMLTokenId> previous = support.getPreviousToken(tOffset);
- typedChars = previous.text().toString().trim();
- completionType = CompletionType.VALUE;
- break;
- }
- }
-
- if (lastTypedChar == '>') {
- completionType = CompletionType.VALUE;
- break;
- }
- completionType = CompletionType.TAG;
- break;
-
- //user enters an attribute name
- case ARGUMENT:
- completionType = CompletionType.ATTRIBUTE;
- typedChars = chars.substring(0, caretOffset - tOffset);
- break;
-
- //some random character
- case CHARACTER:
- //user enters = character, we should ignore all other operators
- case OPERATOR:
- completionType = CompletionType.NONE;
- break;
- //user enters either ' or "
- case VALUE:
- if(!tokenBoundary) {
- completionType = CompletionType.ATTRIBUTE_VALUE;
- typedChars = chars.substring(1, caretOffset - tOffset);
- } else {
- completionType = CompletionType.NONE;
- }
- break;
-
- //user enters white-space character
- case WS:
- completionType = CompletionType.NONE;
- Token<XMLTokenId> prev = support.skip(tOffset, false, XMLTokenId.WS);
- if (prev == null) {
- completionType = CompletionType.NONE;
- break;
- }
- if(prev.id() == XMLTokenId.ARGUMENT) {
- typedChars = prev.text().toString();
- completionType = CompletionType.ATTRIBUTE;
- } else if ((prev.id() == XMLTokenId.VALUE) ||
- (prev.id() == XMLTokenId.TAG)) {
- completionType = CompletionType.ATTRIBUTE;
- }
- break;
-
- default:
- completionType = CompletionType.NONE;
- break;
- }
- }
-
- public CompletionType getCompletionType() {
- return completionType;
- }
-
- public String getTypedPrefix() {
- return typedChars;
- }
-
- public Document getDocument() {
- return this.doc;
- }
-
- public DocumentContext getDocumentContext() {
- return this.documentContext;
- }
-
- public int getCaretOffset() {
- return caretOffset;
- }
-
- public Node getTag() {
- SyntaxElement element = documentContext.getCurrentElement();
- return element.getType() == Node.ELEMENT_NODE ? element.getNode() : null;
- }
-
- public Token<XMLTokenId> getCurrentToken() {
- return documentContext.getCurrentToken();
- }
-
- public int getCurrentTokenOffset() {
- return documentContext.getCurrentTokenOffset();
- }
-
- private List<String> getExistingAttributesLocked(TokenSequence ts) {
- List<String> existingAttributes = new ArrayList<String>();
- while (ts.movePrevious()) {
- Token<XMLTokenId> item = ts.token();
- XMLTokenId tokenId = item.id();
- if (tokenId == XMLTokenId.TAG) {
- break;
- }
- if (tokenId == XMLTokenId.ARGUMENT) {
- existingAttributes.add(item.text().toString());
- }
- }
- return existingAttributes;
- }
-
- public List<String> getExistingAttributes() {
- if (existingAttributes == null) {
- try {
- existingAttributes = (List<String>)support.runWithSequence(
- documentContext.getCurrentTokenOffset(),
- this::getExistingAttributesLocked
- );
- } catch (BadLocationException ex) {
- Exceptions.printStackTrace(ex);
- }
- }
- return existingAttributes;
- }
-
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/Completor.java b/hibernate/src/org/netbeans/modules/hibernate/completion/Completor.java
deleted file mode 100644
index 787c4f8..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/Completor.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.HibernateEditorUtil;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.swing.text.Document;
-import org.netbeans.api.java.source.ClassIndex;
-import org.netbeans.api.java.source.ClassIndex.NameKind;
-import org.netbeans.api.java.source.ClassIndex.SearchScope;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.ElementHandle;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.JavaSource.Phase;
-import org.netbeans.api.java.source.Task;
-import org.netbeans.api.project.FileOwnerQuery;
-import org.netbeans.api.project.Project;
-import org.netbeans.modules.editor.NbEditorUtilities;
-import org.netbeans.modules.hibernate.service.api.HibernateEnvironment;
-import org.netbeans.modules.hibernate.service.TableColumn;
-import org.openide.filesystems.FileObject;
-import org.openide.util.Exceptions;
-
-/**
- * Various completor for code completing XML tags and attributes in Hibername
- * configuration and mapping file
- *
- * @author Dongmei Cao
- */
-public abstract class Completor {
-
- private int anchorOffset = -1;
-
- public abstract List<HibernateCompletionItem> doCompletion(CompletionContext context);
-
- protected void setAnchorOffset(int anchorOffset) {
- this.anchorOffset = anchorOffset;
- }
-
- public int getAnchorOffset() {
- return anchorOffset;
- }
-
- /**
- * A simple completor for general attribute value items
- *
- * Takes an array of strings, the even elements being the display text of the items
- * and the odd ones being the corresponding documentation of the items
- *
- */
- public static class AttributeValueCompletor extends Completor {
-
- private String[] itemTextAndDocs;
-
- public AttributeValueCompletor(String[] itemTextAndDocs) {
- this.itemTextAndDocs = itemTextAndDocs;
- }
-
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- for (int i = 0; i < itemTextAndDocs.length; i += 2) {
- if (itemTextAndDocs[i].startsWith(typedChars.trim())) {
- HibernateCompletionItem item = HibernateCompletionItem.createAttribValueItem(caretOffset - typedChars.length(),
- itemTextAndDocs[i], itemTextAndDocs[i + 1]);
- results.add(item);
- }
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
- return results;
- }
- }
-
- /**
- * A completor for completing the cascade attribute with cascade styles
- *
- */
- public static class CascadeStyleCompletor extends Completor {
-
- private String[] itemTextAndDocs;
-
- public CascadeStyleCompletor(String[] itemTextAndDocs) {
- this.itemTextAndDocs = itemTextAndDocs;
- }
-
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- String styleName = null;
- if (typedChars.contains(",")) {
- int index = typedChars.lastIndexOf(",");
- styleName = typedChars.substring(index + 1);
- } else {
- styleName = typedChars;
- }
-
- for (int i = 0; i < itemTextAndDocs.length; i += 2) {
- if (itemTextAndDocs[i].startsWith(styleName.trim())) {
- HibernateCompletionItem item = HibernateCompletionItem.createCascadeStyleItem(caretOffset - styleName.length(),
- itemTextAndDocs[i], itemTextAndDocs[i + 1]);
- results.add(item);
- }
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
- return results;
- }
- }
-
- /**
- * A completor for completing the Java class attributes
- */
- public static class JavaClassCompletor extends Completor {
-
- private boolean packageOnly = false;
-
- public JavaClassCompletor(boolean packageOnly) {
- this.packageOnly = packageOnly;
- }
-
- public List<HibernateCompletionItem> doCompletion(final CompletionContext context) {
- final List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- try {
- Document doc = context.getDocument();
- final String typedChars = context.getTypedPrefix();
-
- JavaSource js = HibernateEditorUtil.getJavaSource(doc);
- if (js == null) {
- return Collections.emptyList();
- }
-
- if (typedChars.contains(".") || typedChars.equals("")) { // Switch to normal completion
- doNormalJavaCompletion(js, results, typedChars, context.getCurrentTokenOffset() + 1);
- } else { // Switch to smart class path completion
- doSmartJavaCompletion(js, results, typedChars, context.getCurrentTokenOffset() + 1);
- }
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
- }
-
- return results;
- }
-
- private void doNormalJavaCompletion(JavaSource js, final List<HibernateCompletionItem> results,
- final String typedPrefix, final int substitutionOffset) throws IOException {
- js.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.ELEMENTS_RESOLVED);
- ClassIndex ci = cc.getClasspathInfo().getClassIndex();
- int index = substitutionOffset;
- String packName = typedPrefix;
- String classPrefix = "";
- int dotIndex = typedPrefix.lastIndexOf('.'); // NOI18N
- if (dotIndex != -1) {
- index += (dotIndex + 1); // NOI18N
- packName = typedPrefix.substring(0, dotIndex);
- classPrefix = (dotIndex + 1 < typedPrefix.length()) ? typedPrefix.substring(dotIndex + 1) : "";
- }
- addPackages(ci, results, typedPrefix, index);
-
- PackageElement pkgElem = cc.getElements().getPackageElement(packName);
- if (pkgElem == null) {
- return;
- }
-
- if (!packageOnly) {
- List<? extends Element> pkgChildren = pkgElem.getEnclosedElements();
- for (Element pkgChild : pkgChildren) {
- if ((pkgChild.getKind() == ElementKind.CLASS) && pkgChild.getSimpleName().toString().startsWith(classPrefix)) {
- TypeElement typeElement = (TypeElement) pkgChild;
- HibernateCompletionItem item = HibernateCompletionItem.createTypeItem(substitutionOffset,
- typeElement, ElementHandle.create(typeElement),
- cc.getElements().isDeprecated(pkgChild), false);
- results.add(item);
- }
- }
- }
-
- setAnchorOffset(index);
- }
- }, true);
- }
-
- private void doSmartJavaCompletion(final JavaSource js, final List<HibernateCompletionItem> results,
- final String typedPrefix, final int substitutionOffset) throws IOException {
- js.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.ELEMENTS_RESOLVED);
- ClassIndex ci = cc.getClasspathInfo().getClassIndex();
- // add packages
- addPackages(ci, results, typedPrefix, substitutionOffset);
-
- if (!packageOnly) {
- // add classes
- Set<ElementHandle<TypeElement>> matchingTypes = ci.getDeclaredTypes(typedPrefix,
- NameKind.CASE_INSENSITIVE_PREFIX, EnumSet.allOf(SearchScope.class));
- for (ElementHandle<TypeElement> eh : matchingTypes) {
- if (eh.getKind() == ElementKind.CLASS) {
- if (eh.getKind() == ElementKind.CLASS) {
- LazyTypeCompletionItem item = LazyTypeCompletionItem.create(substitutionOffset, eh, js);
- results.add(item);
- }
- }
- }
- }
- }
- }, true);
-
- setAnchorOffset(substitutionOffset);
- }
-
- private void addPackages(ClassIndex ci, List<HibernateCompletionItem> results, String typedPrefix, int substitutionOffset) {
- Set<String> packages = ci.getPackageNames(typedPrefix, true, EnumSet.allOf(SearchScope.class));
- for (String pkg : packages) {
- if (pkg.length() > 0) {
- HibernateCompletionItem item = HibernateCompletionItem.createPackageItem(substitutionOffset, pkg, false);
- results.add(item);
- }
- }
- }
- }
-
- /**
- * A completor for completing Java properties/fields attributes
- */
- public static class PropertyCompletor extends Completor {
-
- public PropertyCompletor() {
- }
-
- @Override
- public List<HibernateCompletionItem> doCompletion(final CompletionContext context) {
-
- final List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- final int caretOffset = context.getCaretOffset();
- final String typedChars = context.getTypedPrefix();
-
- final String className = HibernateEditorUtil.getClassName(context.getTag());
- if (className == null) {
- return Collections.emptyList();
- }
-
- try {
- // Compile the class and find the fiels
- JavaSource classJavaSrc = HibernateEditorUtil.getJavaSource(context.getDocument());
- classJavaSrc.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.ELEMENTS_RESOLVED);
- TypeElement typeElem = cc.getElements().getTypeElement(className);
-
- if (typeElem == null) {
- return;
- }
-
- List<? extends Element> clsChildren = typeElem.getEnclosedElements();
- for (Element clsChild : clsChildren) {
- if (clsChild.getKind() == ElementKind.FIELD) {
- VariableElement elem = (VariableElement) clsChild;
- HibernateCompletionItem item = HibernateCompletionItem.createClassPropertyItem(caretOffset - typedChars.length(), elem, ElementHandle.create(elem), cc.getElements().isDeprecated(clsChild));
- results.add(item);
- }
- }
- }
- }, true);
-
-
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
-
- return results;
- }
- }
-
- /**
- * A completor for completing database table names
- */
- public static class DatabaseTableCompletor extends Completor {
-
- public DatabaseTableCompletor() {
- }
-
- @Override
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- List<String> tableNames = getDatabaseTableNamesForThisMappingFile(context);
-
- for (String tableName : tableNames) {
- if(tableName.startsWith(typedChars.trim())){
- HibernateCompletionItem item = HibernateCompletionItem.createDatabaseTableItem(
- caretOffset - typedChars.length(), tableName);
- results.add(item);
- }
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
-
- return results;
- }
-
- private List<String> getDatabaseTableNamesForThisMappingFile(CompletionContext context) {
- List<String> tableNames = new ArrayList<String>();
- FileObject mappingFile = org.netbeans.modules.editor.NbEditorUtilities.getFileObject(context.getDocument());
- Project enclosingProject = FileOwnerQuery.getOwner(
- mappingFile);
- HibernateEnvironment env = enclosingProject.getLookup().lookup(HibernateEnvironment.class);
- if(env != null) {
- tableNames = env.getDatabaseTables(mappingFile);
- }
- return tableNames;
- }
- }
-
- /**
- * A completor for completing database table column names
- */
- public static class DatabaseTableColumnCompletor extends Completor {
-
- public DatabaseTableColumnCompletor() {
- }
-
- @Override
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- final String tableName = HibernateEditorUtil.getTableName(context.getTag());
-
- if (tableName == null) {
- return Collections.emptyList();
- }
-
- List<TableColumn> tableColumns = getColumnsForTable(context, tableName);
-
- for (TableColumn tableColumn : tableColumns) {
- if(tableColumn.getColumnName().startsWith(typedChars.trim())) {
- HibernateCompletionItem item = HibernateCompletionItem.createDatabaseColumnItem(
- caretOffset - typedChars.length(), tableColumn.getColumnName(), tableColumn.isPrimaryKey());
- results.add(item);
- }
- }
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
-
- return results;
- }
-
- private List<TableColumn> getColumnsForTable(CompletionContext context, String tableName) {
- List<TableColumn> tableColumns = new ArrayList<TableColumn>();
- FileObject currentFileObject = org.netbeans.modules.editor.NbEditorUtilities.getFileObject(context.getDocument());
- Project enclosingProject = FileOwnerQuery.getOwner(
- currentFileObject);
- HibernateEnvironment env = enclosingProject.getLookup().lookup(HibernateEnvironment.class);
- if(env != null) {
- tableColumns = env.getColumnsForTable(tableName, currentFileObject);
- }
- return tableColumns;
- }
- }
-
- /**
- * A completor for completing the Hibernate property names in Hibernate configuration file
- *
- */
- public static class HbPropertyNameCompletor extends Completor {
-
- private String[] itemTextAndDocs;
-
- public HbPropertyNameCompletor(String[] itemTextAndDocs) {
- this.itemTextAndDocs = itemTextAndDocs;
- }
-
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- for (int i = 0; i < itemTextAndDocs.length; i += 2) {
- if (itemTextAndDocs[i].startsWith(typedChars.trim())
- || itemTextAndDocs[i].startsWith( "hibernate." + typedChars.trim()) ) { // NOI18N
- HibernateCompletionItem item = HibernateCompletionItem.createAttribValueItem(caretOffset - typedChars.length(),
- itemTextAndDocs[i], itemTextAndDocs[i + 1]);
- results.add(item);
- }
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
- return results;
- }
- }
-
- /**
- * A completor for completing Hibernate mapping files
- */
- public static class HbMappingFileCompletor extends Completor {
-
- public HbMappingFileCompletor() {
- }
-
- public List<HibernateCompletionItem> doCompletion(CompletionContext context) {
- List<HibernateCompletionItem> results = new ArrayList<HibernateCompletionItem>();
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- String[] mappingFiles = getMappingFilesFromProject(context);
-
- for (int i = 0; i < mappingFiles.length; i++) {
- if (mappingFiles[i].startsWith(typedChars.trim())) {
- HibernateCompletionItem item =
- HibernateCompletionItem.createHbMappingFileItem(caretOffset - typedChars.length(),
- mappingFiles[i]);
- results.add(item);
- }
- }
-
- setAnchorOffset(context.getCurrentTokenOffset() + 1);
- return results;
- }
-
- // Gets the list of mapping files from HibernateEnvironment.
- private String[] getMappingFilesFromProject(CompletionContext context) {
- Project enclosingProject = FileOwnerQuery.getOwner(
- NbEditorUtilities.getFileObject(context.getDocument())
- );
- HibernateEnvironment env = enclosingProject.getLookup().lookup(HibernateEnvironment.class);
- if(env != null) {
- return env.getAllHibernateMappings().toArray(new String[]{});
- } else {
- return new String[0];
- }
-
- }
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionManager.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionManager.java
deleted file mode 100644
index e04508a..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionManager.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.HibernateEditorUtil;
-import org.netbeans.modules.hibernate.editor.DocumentContext;
-import org.netbeans.modules.hibernate.editor.ContextUtilities;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.swing.text.BadLocationException;
-import org.hibernate.cfg.Environment;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.lexer.TokenSequence;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-import org.netbeans.modules.hibernate.cfg.HibernateCfgProperties;
-import org.netbeans.modules.hibernate.cfg.HibernateCfgXmlConstants;
-import org.netbeans.modules.xml.text.api.dom.SyntaxElement;
-import org.netbeans.modules.xml.text.api.dom.TagElement;
-import org.openide.util.NbBundle;
-import org.w3c.dom.Node;
-
-/**
- * This class figures out the completion items for various attributes
- *
- * @author Dongmei Cao
- */
-public final class HibernateCfgCompletionManager {
-
- private static Map<String, Completor> completors = new HashMap<String, Completor>();
-
- private HibernateCfgCompletionManager() {
- setupCompletors();
- }
-
- private void setupCompletors() {
-
- // Completion items for configuration properties
- String[] propertyNames = new String[]{
- Environment.AUTOCOMMIT, NbBundle.getMessage(HibernateCfgCompletionManager.class, "AUTOCOMMIT_DESC"), // NOI18N
- Environment.AUTO_CLOSE_SESSION, NbBundle.getMessage(HibernateCfgCompletionManager.class, "AUTO_CLOSE_SESSION_DESC"), // NOI18N
- Environment.BYTECODE_PROVIDER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "BYTECODE_PROVIDER_DESC"), // NOI18N
- Environment.BATCH_STRATEGY, NbBundle.getMessage(HibernateCfgCompletionManager.class, "BATCH_STRATEGY_DESC"), // NOI18N
- Environment.BATCH_VERSIONED_DATA, NbBundle.getMessage(HibernateCfgCompletionManager.class, "BATCH_VERSIONED_DATA_DESC"), // NOI18N
- Environment.C3P0_ACQUIRE_INCREMENT, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_ACQUIRE_INCREMENT_DESC"), // NOI18N
- Environment.C3P0_IDLE_TEST_PERIOD, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_IDLE_TEST_PERIOD_DESC"), // NOI18N
- Environment.C3P0_MAX_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_MAX_SIZE_DESC"), // NOI18N
- Environment.C3P0_MAX_STATEMENTS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_MAX_STATEMENTS_DESC"), // NOI18N
- Environment.C3P0_MIN_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_MIN_SIZE_DESC"), // NOI18N
- Environment.C3P0_TIMEOUT, NbBundle.getMessage(HibernateCfgCompletionManager.class, "C3P0_TIMEOUT_DESC"), // NOI18N
-// Environment.CACHE_PROVIDER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CACHE_PROVIDER_DESC"), // NOI18N
- Environment.CACHE_REGION_PREFIX, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CACHE_REGION_PREFIX_DESC"), // NOI18N
- Environment.CACHE_PROVIDER_CONFIG, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CACHE_PROVIDER_CONFIG_DESC"), // NOI18N
- Environment.CACHE_NAMESPACE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CACHE_NAMESPACE_DESC"), // NOI18N
- Environment.CONNECTION_PROVIDER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CONNECTION_PROVIDER_DESC"), // NOI18N
- Environment.CONNECTION_PREFIX, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CONNECTION_PREFIX_DESC"), // NOI18N
- Environment.CURRENT_SESSION_CONTEXT_CLASS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "CURRENT_SESSION_CONTEXT_CLASS_DESC"), // NOI18N
- Environment.DATASOURCE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DATASOURCE_DESC"), // NOI18N
- Environment.DEFAULT_BATCH_FETCH_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DEFAULT_BATCH_FETCH_SIZE_DESC"), // NOI18N
- Environment.DEFAULT_CATALOG, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DEFAULT_CATALOG_DESC"), // NOI18N
- Environment.DEFAULT_ENTITY_MODE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DEFAULT_ENTITY_MODE_DESC"), // NOI18N
- Environment.DEFAULT_SCHEMA, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DEFAULT_SCHEMA_DESC"), // NOI18N
- Environment.DIALECT, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DIALECT_DESC"), // NOI18N
- Environment.DRIVER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "DRIVER_DESC"), // NOI18N
- Environment.FLUSH_BEFORE_COMPLETION, NbBundle.getMessage(HibernateCfgCompletionManager.class, "FLUSH_BEFORE_COMPLETION_DESC"), // NOI18N
- Environment.FORMAT_SQL, NbBundle.getMessage(HibernateCfgCompletionManager.class, "FORMAT_SQL_DESC"), // NOI18N
- Environment.GENERATE_STATISTICS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "GENERATE_STATISTICS_DESC"), // NOI18N
- Environment.HBM2DDL_AUTO, NbBundle.getMessage(HibernateCfgCompletionManager.class, "HBM2DDL_AUTO_DESC"), // NOI18N
- Environment.ISOLATION, NbBundle.getMessage(HibernateCfgCompletionManager.class, "ISOLATION_DESC"), // NOI18N
-// Environment.JACC_CONTEXTID, NbBundle.getMessage(HibernateCfgCompletionManager.class, "JACC_CONTEXTID_DESC"), // NOI18N
- Environment.JNDI_CLASS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "JNDI_CLASS_DESC"), // NOI18N
- Environment.JNDI_URL, NbBundle.getMessage(HibernateCfgCompletionManager.class, "JNDI_URL_DESC"), // NOI18N
- Environment.JPAQL_STRICT_COMPLIANCE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "JPAQL_STRICT_COMPLIANCE_DESC"), // NOI18N
- Environment.MAX_FETCH_DEPTH, NbBundle.getMessage(HibernateCfgCompletionManager.class, "MAX_FETCH_DEPTH_DESC"), // NOI18N
- Environment.ORDER_UPDATES, NbBundle.getMessage(HibernateCfgCompletionManager.class, "ORDER_UPDATES_DESC"), // NOI18N
- Environment.OUTPUT_STYLESHEET, NbBundle.getMessage(HibernateCfgCompletionManager.class, "OUTPUT_STYLESHEET_DESC"), // NOI18N
- Environment.PASS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PASS_DESC"), // NOI18N
- Environment.POOL_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "POOL_SIZE_DESC"), // NOI18N
- Environment.PROXOOL_EXISTING_POOL, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PROXOOL_EXISTING_POOL_DESC"), // NOI18N
- Environment.PROXOOL_POOL_ALIAS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PROXOOL_POOL_ALIAS_DESC"), // NOI18N
- Environment.PROXOOL_PREFIX, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PROXOOL_PREFIX_DESC"), // NOI18N
- Environment.PROXOOL_PROPERTIES, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PROXOOL_PROPERTIES_DESC"), // NOI18N
- Environment.PROXOOL_XML, NbBundle.getMessage(HibernateCfgCompletionManager.class, "PROXOOL_XML_DESC"), // NOI18N
- Environment.QUERY_CACHE_FACTORY, NbBundle.getMessage(HibernateCfgCompletionManager.class, "QUERY_CACHE_FACTORY_DESC"), // NOI18N
- Environment.QUERY_TRANSLATOR, NbBundle.getMessage(HibernateCfgCompletionManager.class, "QUERY_TRANSLATOR_DESC"), // NOI18N
- Environment.QUERY_SUBSTITUTIONS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "QUERY_SUBSTITUTIONS_DESC"), // NOI18N
- Environment.QUERY_STARTUP_CHECKING, NbBundle.getMessage(HibernateCfgCompletionManager.class, "QUERY_STARTUP_CHECKING_DESC"), // NOI18N
- Environment.RELEASE_CONNECTIONS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "RELEASE_CONNECTIONS_DESC"), // NOI18N
- Environment.SESSION_FACTORY_NAME, NbBundle.getMessage(HibernateCfgCompletionManager.class, "SESSION_FACTORY_NAME_DESC"), // NOI18N
- Environment.SHOW_SQL, NbBundle.getMessage(HibernateCfgCompletionManager.class, "SHOW_SQL_DESC"), // NOI18N
- Environment.SQL_EXCEPTION_CONVERTER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "SQL_EXCEPTION_CONVERTER_DESC"), // NOI18N
- Environment.STATEMENT_BATCH_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "STATEMENT_BATCH_SIZE_DESC"), // NOI18N
- Environment.STATEMENT_FETCH_SIZE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "STATEMENT_FETCH_SIZE_DESC"), // NOI18N
- Environment.TRANSACTION_STRATEGY, NbBundle.getMessage(HibernateCfgCompletionManager.class, "TRANSACTION_STRATEGY_DESC"), // NOI18N
-// Environment.TRANSACTION_MANAGER_STRATEGY, NbBundle.getMessage(HibernateCfgCompletionManager.class, "TRANSACTION_MANAGER_STRATEGY_DESC"), // NOI18N
- Environment.URL, NbBundle.getMessage(HibernateCfgCompletionManager.class, "URL_DESC"), // NOI18N
- Environment.USER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USER_DESC"), // NOI18N
- Environment.USE_GET_GENERATED_KEYS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_GET_GENERATED_KEYS_DESC"), // NOI18N
- Environment.USE_SCROLLABLE_RESULTSET, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_SCROLLABLE_RESULTSET_DESC"), // NOI18N
- Environment.USE_STREAMS_FOR_BINARY, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_STREAMS_FOR_BINARY_DESC"), // NOI18N
- Environment.USE_IDENTIFIER_ROLLBACK, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_IDENTIFIER_ROLLBACK_DESC"), // NOI18N
- Environment.USE_SQL_COMMENTS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_SQL_COMMENTS_DESC"), // NOI18N
- Environment.USE_MINIMAL_PUTS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_MINIMAL_PUTS_DESC"), // NOI18N
- Environment.USE_QUERY_CACHE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_QUERY_CACHE_DESC"), // NOI18N
- Environment.USE_SECOND_LEVEL_CACHE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_SECOND_LEVEL_CACHE_DESC"), // NOI18N
- Environment.USE_STRUCTURED_CACHE, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_STRUCTURED_CACHE_DESC"), // NOI18N
-// Environment.USER_TRANSACTION, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USER_TRANSACTION_DESC"), // NOI18N
- Environment.USE_REFLECTION_OPTIMIZER, NbBundle.getMessage(HibernateCfgCompletionManager.class, "USE_REFLECTION_OPTIMIZER_DESC"), // NOI18N
- Environment.WRAP_RESULT_SETS, NbBundle.getMessage(HibernateCfgCompletionManager.class, "WRAP_RESULT_SETS_DESC") // NOI18N
- };
-
- // Items for property names
- Completor.HbPropertyNameCompletor propertyNamesCompletor = new Completor.HbPropertyNameCompletor(propertyNames);
- registerCompletor(HibernateCfgXmlConstants.PROPERTY_TAG, HibernateCfgXmlConstants.NAME_ATTRIB, propertyNamesCompletor);
-
- // Items for mapping xml files
- Completor.HbMappingFileCompletor mappingFilesCompletor = new Completor.HbMappingFileCompletor();
- registerCompletor(HibernateCfgXmlConstants.MAPPING_TAG, HibernateCfgXmlConstants.RESOURCE_ATTRIB, mappingFilesCompletor);
-
- Completor.JavaClassCompletor javaClassCompletor = new Completor.JavaClassCompletor(false);
- registerCompletor(HibernateCfgXmlConstants.CLASS_CACHE_TAG, HibernateCfgXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateCfgXmlConstants.COLLECTION_CACHE_TAG, HibernateCfgXmlConstants.COLLECTION_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateCfgXmlConstants.LISTENER_TAG, HibernateCfgXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateCfgXmlConstants.MAPPING_TAG, HibernateCfgXmlConstants.CLASS_ATTRIB, javaClassCompletor);
-
- Completor.JavaClassCompletor javaPkgCompletor = new Completor.JavaClassCompletor(true);
- registerCompletor(HibernateCfgXmlConstants.MAPPING_TAG, HibernateCfgXmlConstants.PACKAGE_ATTRIB, javaPkgCompletor);
- }
-
- private static HibernateCfgCompletionManager INSTANCE = new HibernateCfgCompletionManager();
-
- public static HibernateCfgCompletionManager getDefault() {
- return INSTANCE;
- }
-
- public int completeAttributeValues(CompletionContext context, List<HibernateCompletionItem> valueItems) {
- int anchorOffset = -1;
-
- if(context.getTag() == null)
- return anchorOffset;
-
- String tagName = context.getTag().getNodeName();
- Token<XMLTokenId> attrib = ContextUtilities.getAttributeToken(context.getDocumentContext());
- String attribName = attrib != null ? attrib.text().toString(): null;
-
- Completor completor = locateCompletor(tagName, attribName);
- if (completor != null) {
- valueItems.addAll(completor.doCompletion(context));
- if (completor.getAnchorOffset() != -1) {
- anchorOffset = completor.getAnchorOffset();
- }
- }
-
- return anchorOffset;
- }
-
- public int completeValues(CompletionContext context, List<HibernateCompletionItem> valueItems) {
- int anchorOffset = -1;
- DocumentContext docContext = context.getDocumentContext();
- SyntaxElement curElem = docContext.getCurrentElement();
- SyntaxElement prevElem = docContext.getCurrentElement().getPrevious();
- TagElement propTag = null;
-
- // If current element is a start tag and its tag is <property>
- // or the current element is text and its prev is a start <property> tag,
- // then do the code completion
- if (curElem.getType() == Node.ELEMENT_NODE &&
- ((TagElement)curElem).isStart() && HibernateCfgXmlConstants.PROPERTY_TAG.equalsIgnoreCase(curElem.getNode().getNodeName())) {
- propTag = (TagElement) curElem;
- } else if (curElem.getType() == Node.TEXT_NODE &&
- (prevElem.getType() == Node.ELEMENT_NODE && ((TagElement)prevElem).isStart() &&
- HibernateCfgXmlConstants.PROPERTY_TAG.equalsIgnoreCase(prevElem.getNode().getNodeName()))) {
- propTag = (TagElement) prevElem;
- } else {
- return anchorOffset;
- }
-
- String propName = HibernateEditorUtil.getHbPropertyName(propTag.getNode());
- int caretOffset = context.getCaretOffset();
- String typedChars = context.getTypedPrefix();
-
- Object possibleValue = HibernateCfgProperties.getPossiblePropertyValue(propName);
-
- if (possibleValue instanceof String[]) {
-
- // Add the values in the String[] as completion items
- String[] values = (String[])possibleValue;
-
- for (int i = 0; i < values.length; i++) {
- if (values[i].startsWith(typedChars.trim())
- || values[i].startsWith( "org.hibernate.dialect." + typedChars.trim()) ) { // NOI18N
- HibernateCompletionItem item =
- HibernateCompletionItem.createHbPropertyValueItem(caretOffset-typedChars.length(), values[i]);
- valueItems.add(item);
- }
- }
- try {
- anchorOffset = context.getDocumentContext().
- runWithSequence((TokenSequence s) -> {
- if (!s.movePrevious()) {
- return -1;
- }
- return s.offset();
- });
- } catch (BadLocationException ex) {
- anchorOffset = -1;
- }
- }
-
- return anchorOffset;
- }
-
- public int completeAttributes(CompletionContext context, List<HibernateCompletionItem> attributeItems) {
- return -1;
- }
-
- public int completeElements(CompletionContext context, List<HibernateCompletionItem> elementItems) {
- return -1;
- }
-
-
-
- private void registerCompletor(String tagName, String attribName,
- Completor completor) {
- completors.put(createRegisteredName(tagName, attribName), completor);
- }
-
- private static String createRegisteredName(String nodeName, String attributeName) {
- StringBuilder builder = new StringBuilder();
- if (nodeName != null && nodeName.trim().length() > 0) {
- builder.append("/nodeName="); // NOI18N
- builder.append(nodeName);
- } else {
- builder.append("/nodeName="); // NOI18N
- builder.append("*"); // NOI18N
- }
-
- if (attributeName != null && attributeName.trim().length() > 0) {
- builder.append("/attribute="); // NOI18N
- builder.append(attributeName);
- }
-
- return builder.toString();
- }
-
- private Completor locateCompletor(String nodeName, String attributeName) {
- String key = createRegisteredName(nodeName, attributeName);
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- key = createRegisteredName("*", attributeName); // NOI18N
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- return null;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionProvider.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionProvider.java
deleted file mode 100644
index 7f24778..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import javax.swing.text.JTextComponent;
-import org.netbeans.spi.editor.completion.CompletionProvider;
-import org.netbeans.spi.editor.completion.CompletionTask;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
-
-/**
- * Code completion provider for Hibernate configuration xml file
- *
- * @author Dongmei Cao
- */
-public class HibernateCfgCompletionProvider implements CompletionProvider {
-
- public CompletionTask createTask(int queryType, JTextComponent component) {
- if( queryType != CompletionProvider.COMPLETION_QUERY_TYPE )
- return null;
-
- return new AsyncCompletionTask(new HibernateCfgCompletionQuery(queryType,
- component.getSelectionStart()), component);
- }
-
- public int getAutoQueryTypes(JTextComponent component, String typedText) {
- // return 0 here, meaning no query should be automatically invoked.
- // If we want some query to be invoked automatically, then a combination of the
- // COMPLETION_QUERY_TYPE,
- // COMPLETION_ALL_QUERY_TYPE,
- // DOCUMENTATION_QUERY_TYPE,
- // and TOOLTIP_QUERY_TYPE values should be returned
- return 0;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionQuery.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionQuery.java
deleted file mode 100644
index 0a348fc..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCfgCompletionQuery.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-import org.netbeans.modules.hibernate.completion.CompletionContext.CompletionType;
-import org.netbeans.spi.editor.completion.CompletionResultSet;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
-
-/**
- * Code completion query for Hibernate configuration xml file
- *
- * @author Dongmei Cao
- */
-public class HibernateCfgCompletionQuery extends AsyncCompletionQuery {
-
- private int queryType;
- private int caretOffset;
- private JTextComponent component;
-
- public HibernateCfgCompletionQuery(int queryType, int caretOffset) {
- this.queryType = queryType;
- this.caretOffset = caretOffset;
- }
-
- @Override
- protected void preQueryUpdate(JTextComponent component) {
- //XXX: look for invalidation conditions
- this.component = component;
- }
-
- @Override
- protected void prepareQuery(JTextComponent component) {
- this.component = component;
- }
-
- @Override
- protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
- List<HibernateCompletionItem> completionItems = new ArrayList<HibernateCompletionItem>();
-
- int anchorOffset = getCompletionItems(doc, caretOffset, completionItems);
-
- resultSet.addAllItems(completionItems);
- if (anchorOffset != -1) {
- resultSet.setAnchorOffset(anchorOffset);
- }
-
- resultSet.finish();
- }
-
- // This method is here for Unit testing purpose
- int getCompletionItems(Document doc, int caretOffset, List<HibernateCompletionItem> completionItems) {
-
- int anchorOffset = -1;
- CompletionContext context = new CompletionContext(doc, caretOffset);
-
- if (context.getCompletionType() == CompletionType.NONE) {
- return anchorOffset;
- }
-
- switch (context.getCompletionType()) {
- case ATTRIBUTE_VALUE:
- anchorOffset = HibernateCfgCompletionManager.getDefault().completeAttributeValues(context, completionItems);
- break;
- case ATTRIBUTE:
- anchorOffset = HibernateCfgCompletionManager.getDefault().completeAttributes(context, completionItems);
- break;
- case TAG:
- anchorOffset = HibernateCfgCompletionManager.getDefault().completeElements(context, completionItems);
- break;
- case VALUE:
- anchorOffset = HibernateCfgCompletionManager.getDefault().completeValues(context, completionItems);
- break;
- }
-
- return anchorOffset;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionDocumentation.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionDocumentation.java
deleted file mode 100644
index 30fafa7..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionDocumentation.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.completion;
-
-import java.net.URL;
-import javax.lang.model.element.Element;
-import javax.swing.Action;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.ui.ElementJavadoc;
-import org.netbeans.spi.editor.completion.CompletionDocumentation;
-
-/**
- *
- *
- */
-public abstract class HibernateCompletionDocumentation implements CompletionDocumentation {
-
- public static HibernateCompletionDocumentation getAttribValueDoc(String text) {
- return new AttribValueDoc(text);
- }
-
- public static HibernateCompletionDocumentation createJavaDoc(CompilationController cc, Element element) {
- return new JavaElementDoc(ElementJavadoc.create(cc, element));
- }
-
- public URL getURL() {
- return null;
- }
-
- public CompletionDocumentation resolveLink(String link) {
- return null;
- }
-
- public Action getGotoSourceAction() {
- return null;
- }
-
-
-
- private static class AttribValueDoc extends HibernateCompletionDocumentation {
-
- private String text;
-
- public AttribValueDoc(String text) {
- this.text = text;
- }
-
- public String getText() {
- return text;
- }
- }
-
- private static class JavaElementDoc extends HibernateCompletionDocumentation {
-
- private ElementJavadoc elementJavadoc;
-
- public JavaElementDoc(ElementJavadoc elementJavadoc) {
- this.elementJavadoc = elementJavadoc;
- }
-
- @Override
- public JavaElementDoc resolveLink(String link) {
- ElementJavadoc doc = elementJavadoc.resolveLink(link);
- return doc != null ? new JavaElementDoc(doc) : null;
- }
-
- @Override
- public URL getURL() {
- return elementJavadoc.getURL();
- }
-
- public String getText() {
- return elementJavadoc.getText();
- }
-
- @Override
- public Action getGotoSourceAction() {
- return elementJavadoc.getGotoSourceAction();
- }
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionItem.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionItem.java
deleted file mode 100644
index 77eb460..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateCompletionItem.java
+++ /dev/null
@@ -1,866 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.HibernateEditorUtil;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.event.KeyEvent;
-import java.io.IOException;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.TypeKind;
-import javax.lang.model.util.SimpleElementVisitor6;
-import org.netbeans.api.editor.completion.Completion;
-import javax.swing.ImageIcon;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.Position;
-import org.netbeans.api.editor.EditorRegistry;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.ElementHandle;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.JavaSource.Phase;
-import org.netbeans.api.java.source.Task;
-import org.netbeans.editor.BaseDocument;
-import org.netbeans.spi.editor.completion.CompletionDocumentation;
-import org.netbeans.spi.editor.completion.CompletionItem;
-import org.netbeans.spi.editor.completion.CompletionResultSet;
-import org.netbeans.spi.editor.completion.CompletionTask;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
-import org.netbeans.spi.editor.completion.support.CompletionUtilities;
-import org.openide.util.Exceptions;
-import org.openide.util.ImageUtilities;
-import org.openide.util.Utilities;
-
-/**
- *
- * @author Dongmei Cao
- */
-public abstract class HibernateCompletionItem implements CompletionItem {
-
- /**
- * Creates items for completing static attribute values
- *
- * @param substitutionOffset
- * @param displayText
- * @param docText
- * @return
- */
- public static HibernateCompletionItem createAttribValueItem(int substitutionOffset, String displayText, String docText) {
- return new AttribValueItem(substitutionOffset, displayText, docText);
- }
-
- /**
- * Creates items for completing package names
- *
- * @param substitutionOffset
- * @param packageName
- * @param deprecated
- * @return
- */
- public static HibernateCompletionItem createPackageItem(int substitutionOffset, String packageName,
- boolean deprecated) {
- return new PackageItem(substitutionOffset, packageName, deprecated);
- }
-
- /**
- * Creates items for completing
- *
- * @param substitutionOffset
- * @param elem
- * @param elemHandle
- * @param deprecated
- * @param smartItem
- * @return
- */
- public static HibernateCompletionItem createTypeItem(int substitutionOffset, TypeElement elem, ElementHandle<TypeElement> elemHandle,
- boolean deprecated, boolean smartItem) {
- return new ClassItem(substitutionOffset, elem, elemHandle, deprecated, smartItem);
- }
-
- /**
- * Creates items for completing class properties/fields
- *
- * @param substitutionOffset
- * @param variableElem
- * @param elemHandle
- * @param deprecated
- * @return
- */
- public static HibernateCompletionItem createClassPropertyItem(int substitutionOffset, VariableElement variableElem, ElementHandle<VariableElement> elemHandle, boolean deprecated) {
- return new ClassPropertyItem(substitutionOffset, variableElem, elemHandle, deprecated);
- }
-
- /**
- * Creates items for completing database table names
- *
- * @param substitutionOffset
- * @param name
- * @return
- */
- public static HibernateCompletionItem createDatabaseTableItem(int substitutionOffset, String name) {
- return new DatabaseTableItem(substitutionOffset, name);
- }
-
- /**
- * Creates items for completing database table column names
- *
- * @param substitutionOffset
- * @param name
- * @param pk
- * @return
- */
- public static HibernateCompletionItem createDatabaseColumnItem(int substitutionOffset, String name, boolean pk) {
- return new DatabaseColumnItem(substitutionOffset, name, pk);
- }
-
- /**
- * Creates items for completing database cascade styles
- *
- * @param substitutionOffset
- * @param displayText
- * @param docText
- * @return
- */
- public static HibernateCompletionItem createCascadeStyleItem(int substitutionOffset, String displayText, String docText) {
- return new CascadeStyleItem(substitutionOffset, displayText, docText);
- }
-
- /**
- * Creates items for completing Hibernate mapping files
- *
- * @param substitutionOffset
- * @param displayText
- * @return
- */
- public static HibernateCompletionItem createHbMappingFileItem(int substitutionOffset, String displayText) {
- return new HbMappingFileItem(substitutionOffset, displayText);
- }
-
- /**
- * Creates items for completing certain Hibernate properties
- *
- * @param substitutionOffset
- * @param displayText
- * @return
- */
- public static HibernateCompletionItem createHbPropertyValueItem(int substitutionOffset, String displayText) {
- return new HbPropertyValueItem(substitutionOffset, displayText);
- }
-
-
- protected int substitutionOffset;
-
- protected HibernateCompletionItem(int substitutionOffset) {
- this.substitutionOffset = substitutionOffset;
- }
-
- public void defaultAction(JTextComponent component) {
- if (component != null) {
- Completion.get().hideDocumentation();
- Completion.get().hideCompletion();
- int caretOffset = component.getSelectionEnd();
- substituteText(component, substitutionOffset, caretOffset - substitutionOffset, null);
- }
- }
-
- protected void substituteText(JTextComponent c, int offset, int len, String toAdd) {
- BaseDocument doc = (BaseDocument) c.getDocument();
- CharSequence prefix = getInsertPrefix();
- String text = prefix.toString();
- if (toAdd != null) {
- text += toAdd;
- }
-
- doc.atomicLock();
- try {
- Position position = doc.createPosition(offset);
- doc.remove(offset, len);
- doc.insertString(position.getOffset(), text.toString(), null);
- } catch (BadLocationException ble) {
- // nothing can be done to update
- } finally {
- doc.atomicUnlock();
- }
- }
-
- protected CharSequence getSubstitutionText() {
- return getInsertPrefix();
- }
-
- public void processKeyEvent(KeyEvent evt) {
- }
-
- public int getPreferredWidth(Graphics g, Font defaultFont) {
- return CompletionUtilities.getPreferredWidth(getLeftHtmlText(),
- getRightHtmlText(), g, defaultFont);
- }
-
- public void render(Graphics g, Font defaultFont, Color defaultColor,
- Color backgroundColor, int width, int height, boolean selected) {
- CompletionUtilities.renderHtml(getIcon(), getLeftHtmlText(),
- getRightHtmlText(), g, defaultFont, defaultColor, width, height, selected);
- }
-
- public CompletionTask createDocumentationTask() {
- return null;
- }
-
- public CompletionTask createToolTipTask() {
- return null;
- }
-
- public boolean instantSubstitution(JTextComponent component) {
- defaultAction(component);
- return true;
- }
-
- protected String getLeftHtmlText() {
- return null;
- }
-
- protected String getRightHtmlText() {
- return null;
- }
-
- protected ImageIcon getIcon() {
- return null;
- }
-
- public abstract String getDisplayText();
-
- /**
- * Represents a class in the completion popup.
- *
- * Heavily derived from Java Editor module's JavaCompletionItem class
- *
- */
- private static class ClassPropertyItem extends HibernateCompletionItem {
-
- private static final String FIELD_ICON = "org/netbeans/modules/editor/resources/completion/field_16.png"; //NOI18N
- private ElementHandle<VariableElement> elemHandle;
- private boolean deprecated;
- private String displayName;
-
- public ClassPropertyItem(int substitutionOffset, VariableElement elem, ElementHandle<VariableElement> elemHandle,
- boolean deprecated) {
- super(substitutionOffset);
- this.elemHandle = elemHandle;
- this.deprecated = deprecated;
- this.displayName = elem.getSimpleName().toString();
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayName;
- }
-
- public CharSequence getInsertPrefix() {
- return displayName;
- }
-
- public String getDisplayText() {
- return displayName;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayName;
- }
-
- @Override
- protected ImageIcon getIcon() {
-
- return ImageUtilities.loadImageIcon(FIELD_ICON, false);
- }
-
- @Override
- public CompletionTask createDocumentationTask() {
- return new AsyncCompletionTask(new AsyncCompletionQuery() {
-
- @Override
- protected void query(final CompletionResultSet resultSet, Document doc, int caretOffset) {
- try {
- JavaSource js = HibernateEditorUtil.getJavaSource(doc);
- if (js == null) {
- return;
- }
-
- js.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.RESOLVED);
- Element element = elemHandle.resolve(cc);
- if (element == null) {
- return;
- }
- HibernateCompletionDocumentation doc = HibernateCompletionDocumentation.createJavaDoc(cc, element);
- resultSet.setDocumentation(doc);
- }
- }, false);
- resultSet.finish();
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
- }
- }
- }, EditorRegistry.lastFocusedComponent());
- }
- }
- public static final String COLOR_END = "</font>"; //NOI18N
- public static final String STRIKE = "<s>"; //NOI18N
- public static final String STRIKE_END = "</s>"; //NOI18N
- public static final String BOLD = "<b>"; //NOI18N
- public static final String BOLD_END = "</b>"; //NOI18N
-
- /**
- * Represents a class in the completion popup.
- *
- * Heavily derived from Java Editor module's JavaCompletionItem class
- *
- */
- private static class ClassItem extends HibernateCompletionItem {
-
- private static final String CLASS = "org/netbeans/modules/editor/resources/completion/class_16.png"; //NOI18N
- private static final String CLASS_COLOR = "<font color=#560000>"; //NOI18N
- private static final String PKG_COLOR = "<font color=#808080>"; //NOI18N
- private ElementHandle<TypeElement> elemHandle;
- private boolean deprecated;
- private String displayName;
- private String enclName;
- private String sortText;
- private String leftText;
- private boolean smartItem;
-
- public ClassItem(int substitutionOffset, TypeElement elem, ElementHandle<TypeElement> elemHandle,
- boolean deprecated, boolean smartItem) {
- super(substitutionOffset);
- this.elemHandle = elemHandle;
- this.deprecated = deprecated;
- this.displayName = smartItem ? elem.getSimpleName().toString() : getRelativeName(elem);
- this.enclName = getElementName(elem.getEnclosingElement(), true).toString();
- this.sortText = this.displayName + getImportanceLevel(this.enclName) + "#" + this.enclName; //NOI18N
- this.smartItem = smartItem;
- }
-
- private String getRelativeName(TypeElement elem) {
- StringBuilder sb = new StringBuilder();
- sb.append(elem.getSimpleName().toString());
- Element parent = elem.getEnclosingElement();
- while (parent.getKind() != ElementKind.PACKAGE) {
- sb.insert(0, parent.getSimpleName().toString() + "$"); // NOI18N
- parent = parent.getEnclosingElement();
- }
-
- return sb.toString();
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return sortText;
- }
-
- public CharSequence getInsertPrefix() {
- return smartItem ? "" : elemHandle.getBinaryName(); // NOI18N
- }
-
- public String getDisplayText() {
- return displayName;
- }
-
- @Override
- protected CharSequence getSubstitutionText() {
- return elemHandle.getBinaryName();
- }
-
- @Override
- public boolean instantSubstitution(JTextComponent component) {
- return false;
- }
-
- @Override
- protected String getLeftHtmlText() {
- if (leftText == null) {
- StringBuilder sb = new StringBuilder();
- sb.append(getColor());
- if (deprecated) {
- sb.append(STRIKE);
- }
- sb.append(displayName);
- if (deprecated) {
- sb.append(STRIKE_END);
- }
- if (smartItem && enclName != null && enclName.length() > 0) {
- sb.append(COLOR_END);
- sb.append(PKG_COLOR);
- sb.append(" ("); //NOI18N
- sb.append(enclName);
- sb.append(")"); //NOI18N
- }
- sb.append(COLOR_END);
- leftText = sb.toString();
- }
- return leftText;
- }
-
- protected String getColor() {
- return CLASS_COLOR;
- }
-
- @Override
- protected ImageIcon getIcon() {
- return ImageUtilities.loadImageIcon(CLASS, false);
- }
-
- @Override
- public CompletionTask createDocumentationTask() {
- return new AsyncCompletionTask(new AsyncCompletionQuery() {
-
- @Override
- protected void query(final CompletionResultSet resultSet, Document doc, int caretOffset) {
- try {
- JavaSource js = HibernateEditorUtil.getJavaSource(doc);
- if (js == null) {
- return;
- }
-
- js.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.RESOLVED);
- Element element = elemHandle.resolve(cc);
- if (element == null) {
- return;
- }
- HibernateCompletionDocumentation doc = HibernateCompletionDocumentation.createJavaDoc(cc, element);
- resultSet.setDocumentation(doc);
- }
- }, false);
- resultSet.finish();
- } catch (IOException ex) {
- Exceptions.printStackTrace(ex);
- }
- }
- }, EditorRegistry.lastFocusedComponent());
- }
- }
-
- private static class PackageItem extends HibernateCompletionItem {
-
- private static final String PACKAGE = "org/netbeans/modules/java/editor/resources/package.gif"; // NOI18N
- private static final String PACKAGE_COLOR = "<font color=#005600>"; //NOI18N
- private static ImageIcon icon;
- private boolean deprecated;
- private String simpleName;
- private String sortText;
- private String leftText;
-
- public PackageItem(int substitutionOffset, String packageFQN, boolean deprecated) {
- super(substitutionOffset);
- int idx = packageFQN.lastIndexOf('.'); // NOI18N
- this.simpleName = idx < 0 ? packageFQN : packageFQN.substring(idx + 1);
- this.deprecated = deprecated;
- this.sortText = this.simpleName + "#" + packageFQN; //NOI18N
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return sortText;
- }
-
- public CharSequence getInsertPrefix() {
- return simpleName;
- }
-
- @Override
- public void processKeyEvent(KeyEvent evt) {
- if (evt.getID() == KeyEvent.KEY_TYPED) {
- if (evt.getKeyChar() == '.') { // NOI18N
- Completion.get().hideDocumentation();
- JTextComponent component = (JTextComponent) evt.getSource();
- int caretOffset = component.getSelectionEnd();
- substituteText(component, substitutionOffset, caretOffset - substitutionOffset, Character.toString(evt.getKeyChar()));
- Completion.get().showCompletion();
- evt.consume();
- }
- }
- }
-
- public String getDisplayText() {
- return simpleName;
- }
-
- @Override
- protected ImageIcon getIcon() {
- if (icon == null) {
- icon = ImageUtilities.loadImageIcon(PACKAGE, false);
- }
- return icon;
- }
-
- @Override
- protected String getLeftHtmlText() {
- if (leftText == null) {
- StringBuilder sb = new StringBuilder();
- sb.append(PACKAGE_COLOR);
- if (deprecated) {
- sb.append(STRIKE);
- }
- sb.append(simpleName);
- if (deprecated) {
- sb.append(STRIKE_END);
- }
- sb.append(COLOR_END);
- leftText = sb.toString();
- }
- return leftText;
- }
- }
-
- private static class AttribValueItem extends HibernateCompletionItem {
-
- private String displayText;
- private String docText;
-
- public AttribValueItem(int substitutionOffset, String displayText, String docText) {
- super(substitutionOffset);
- this.displayText = displayText;
- this.docText = docText;
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
-
- @Override
- public CompletionTask createDocumentationTask() {
- return new AsyncCompletionTask(new AsyncCompletionQuery() {
-
- @Override
- protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
- if (docText != null) {
- CompletionDocumentation documentation = HibernateCompletionDocumentation.getAttribValueDoc(docText);
- resultSet.setDocumentation(documentation);
- }
- resultSet.finish();
- }
- });
- }
- }
-
- private static class DatabaseTableItem extends HibernateCompletionItem {
-
- private static final String TABLE_ICON = "org/netbeans/modules/hibernate/resources/completion/table.gif"; //NOI18N
- private String displayText;
-
- public DatabaseTableItem(int substitutionOffset, String name) {
- super(substitutionOffset);
- this.displayText = name;
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
-
- @Override
- protected ImageIcon getIcon() {
- return ImageUtilities.loadImageIcon(TABLE_ICON, false);
- }
- }
-
- private static class DatabaseColumnItem extends HibernateCompletionItem {
-
- private static final String COLUMN_ICON = "org/netbeans/modules/hibernate/resources/completion/column.gif"; //NOI18N
- private static final String PK_COLUMN_ICON = "org/netbeans/modules/hibernate/resources/completion/columnPrimary.gif"; //NOI18N
- private String displayText;
- private boolean pk;
-
- public DatabaseColumnItem(int substitutionOffset, String columnName, boolean pk) {
- super(substitutionOffset);
- this.displayText = columnName;
- this.pk = pk;
- }
-
- public int getSortPriority() {
- if (pk) {
- return 1;
- } else {
- return 5;
- }
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
-
- @Override
- protected ImageIcon getIcon() {
- if (pk) {
- return ImageUtilities.loadImageIcon(PK_COLUMN_ICON, false);
- } else {
- return ImageUtilities.loadImageIcon(COLUMN_ICON, false);
- }
- }
- }
-
- private static class CascadeStyleItem extends HibernateCompletionItem {
-
- private String displayText;
- private String docText;
-
- public CascadeStyleItem(int substitutionOffset, String displayText, String docText) {
- super(substitutionOffset);
- this.displayText = displayText;
- this.docText = docText;
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
-
- @Override
- public void processKeyEvent(KeyEvent evt) {
- if (evt.getID() == KeyEvent.KEY_TYPED) {
- if (evt.getKeyChar() == ',') { // NOI18N
- Completion.get().hideDocumentation();
- JTextComponent component = (JTextComponent) evt.getSource();
- int caretOffset = component.getSelectionEnd();
- substituteText(component, substitutionOffset, caretOffset - substitutionOffset, Character.toString(evt.getKeyChar()));
- Completion.get().showCompletion();
- evt.consume();
- }
- }
- }
-
- @Override
- public CompletionTask createDocumentationTask() {
- return new AsyncCompletionTask(new AsyncCompletionQuery() {
-
- @Override
- protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
- if (docText != null) {
- CompletionDocumentation documentation = HibernateCompletionDocumentation.getAttribValueDoc(docText);
- resultSet.setDocumentation(documentation);
- }
- resultSet.finish();
- }
- });
- }
- }
-
- private static class HbMappingFileItem extends HibernateCompletionItem {
-
- private static final String HB_MAPPING_ICON = "org/netbeans/modules/hibernate/resources/hibernate-mapping.png"; //NOI18N
- private String displayText;
-
- public HbMappingFileItem(int substitutionOffset, String displayText) {
- super(substitutionOffset);
- this.displayText = displayText;
- }
-
- public int getSortPriority() {
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
-
- @Override
- protected ImageIcon getIcon() {
- return ImageUtilities.loadImageIcon(HB_MAPPING_ICON, false);
- }
- }
-
- private static class HbPropertyValueItem extends HibernateCompletionItem {
-
- private String displayText;
-
- public HbPropertyValueItem(int substitutionOffset, String displayText) {
- super(substitutionOffset);
- this.displayText = displayText;
- }
-
- public int getSortPriority() {
- if(displayText.startsWith("--")) // NOI18N
- // The entry such as "--Enter your custom class--" should be the last
- return 101;
- else if(displayText.equals("true")) // NOI18N
- // Want the "true" always to be the first
- return 98;
- else if(displayText.equals("false")) // NOI18N
- // Want the "false" always to be the second
- return 99;
- else
- // Everything else can be order alphabetically
- return 100;
- }
-
- public CharSequence getSortText() {
- return displayText;
- }
-
- public CharSequence getInsertPrefix() {
- return displayText;
- }
-
- public String getDisplayText() {
- return displayText;
- }
-
- @Override
- protected String getLeftHtmlText() {
- return displayText;
- }
- }
-
- public static int getImportanceLevel(String fqn) {
- int weight = 50;
- if (fqn.startsWith("java.lang") || fqn.startsWith("java.util")) // NOI18N
- {
- weight -= 10;
- } else if (fqn.startsWith("org.omg") || fqn.startsWith("org.apache")) // NOI18N
- {
- weight += 10;
- } else if (fqn.startsWith("com.sun") || fqn.startsWith("com.ibm") || fqn.startsWith("com.apple")) // NOI18N
- {
- weight += 20;
- } else if (fqn.startsWith("sun") || fqn.startsWith("sunw") || fqn.startsWith("netscape")) // NOI18N
- {
- weight += 30;
- }
- return weight;
- }
-
- public static CharSequence getElementName(Element el, boolean fqn) {
- if (el == null || el.asType().getKind() == TypeKind.NONE) {
- return "";
- } //NOI18N
- return new ElementNameVisitor().visit(el, fqn);
- }
-
- private static class ElementNameVisitor extends SimpleElementVisitor6<StringBuilder, Boolean> {
-
- private ElementNameVisitor() {
- super(new StringBuilder());
- }
-
- @Override
- public StringBuilder visitPackage(PackageElement e, Boolean p) {
- return DEFAULT_VALUE.append((p ? e.getQualifiedName() : e.getSimpleName()).toString());
- }
-
- @Override
- public StringBuilder visitType(TypeElement e, Boolean p) {
- return DEFAULT_VALUE.append((p ? e.getQualifiedName() : e.getSimpleName()).toString());
- }
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionManager.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionManager.java
deleted file mode 100644
index cd15f71..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionManager.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.ContextUtilities;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-import org.netbeans.modules.hibernate.mapping.HibernateMappingXmlConstants;
-import org.openide.util.NbBundle;
-
-/**
- * This class figures out the completion items for various attributes
- *
- * @author Dongmei Cao
- */
-public final class HibernateMappingCompletionManager {
-
- private static Map<String, Completor> completors = new HashMap<String, Completor>();
-
- private HibernateMappingCompletionManager() {
- setupCompletors();
- }
-
- private void setupCompletors() {
-
- // Completion items for id generator
- String[] generatorClasses = new String[]{
- "increment", NbBundle.getMessage(HibernateMappingCompletionManager.class, "INCREMENT_GENERATOR_DESC"), // NOI18N
- "identity", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IDENTITY_GENERATOR_DESC"), // NOI18N
- "sequence", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SEQUENCE_GENERATOR_DESC"), // NOI18N
- "hilo", NbBundle.getMessage(HibernateMappingCompletionManager.class, "HILO_GENERATOR_DESC"), // NOI18N
- "seqhilo", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SEQHILO_GENERATOR_DESC"), // NOI18N
- "uuid", NbBundle.getMessage(HibernateMappingCompletionManager.class, "UUID_GENERATOR_DESC"), // NOI18N
- "guid", NbBundle.getMessage(HibernateMappingCompletionManager.class, "GUID_GENERATOR_DESC"), // NOI18N
- "native", NbBundle.getMessage(HibernateMappingCompletionManager.class, "NATIVE_GENERATOR_DESC"), // NOI18N
- "assigned", NbBundle.getMessage(HibernateMappingCompletionManager.class, "ASSIGNED_GENERATOR_DESC"), // NOI18N
- "select", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SELECT_GENERATOR_DESC"), // NOI18N
- "foreign", NbBundle.getMessage(HibernateMappingCompletionManager.class, "FOREIGN_GENERATOR_DESC"), // NOI18N
- "sequence-identity", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SEQUENCE_IDENTITY_GENERATOR_DESC") // NOI18N
- // NOI18N
- };
-
- // Completion items for Hibernate type
- String[] hibernateTypes = new String[]{
- "big_decimal", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BIG_DECIMAL_DESC"), // NOI18N
- "big_integer", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BIG_INTEGER_DESC"), // NOI18N
- "binary", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BINARY_DESC"), // NOI18N
- "blob", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BLOB_DESC"), // NOI18N
- "boolean", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BOOLEAN_DESC"), // NOI18N
- "byte", NbBundle.getMessage(HibernateMappingCompletionManager.class, "BYTE_DESC"), // NOI18N
- "calendar", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CALENDAR_DESC"), // NOI18N
- "calendar_date", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CALENDAR_DATE_DESC"), // NOI18N
- "character", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CHARACTER_DESC"), // NOI18N
- "class", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CLASS_DESC"), // NOI18N
- "clob", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CLOB_DESC"), // NOI18N
- "currency", NbBundle.getMessage(HibernateMappingCompletionManager.class, "CURRENCY_DESC"), // NOI18N
- "date", NbBundle.getMessage(HibernateMappingCompletionManager.class, "DATE_DESC"), // NOI18N
- "double", NbBundle.getMessage(HibernateMappingCompletionManager.class, "DOUBLE_DESC"), // NOI18N
- "float", NbBundle.getMessage(HibernateMappingCompletionManager.class, "FLOAT_DESC"), // NOI18N
- "imm_binary", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_BINARY_DESC"), // NOI18N
- "imm_calendar", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_CALENDAR_DESC"), // NOI18N
- "imm_calendar_date", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_CALENDAR_DATE_DESC"), // NOI18N
- "imm_date", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_DATE_DESC"), // NOI18N
- "imm_serializable", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_SERIALIZABLE_DESC"), // NOI18N
- "imm_time", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_TIME_DESC"), // NOI18N
- "imm_timestamp", NbBundle.getMessage(HibernateMappingCompletionManager.class, "IMM_TIMESTAMP_DESC"), // NOI18N
- "integer", NbBundle.getMessage(HibernateMappingCompletionManager.class, "INTEGER_DESC"), // NOI18N
- "locale", NbBundle.getMessage(HibernateMappingCompletionManager.class, "LOCALE_DESC"), // NOI18N
- "long", NbBundle.getMessage(HibernateMappingCompletionManager.class, "LONG_DESC"), // NOI18N
- "serializable", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SERIALIZABLE_DESC"), // NOI18N
- "short", NbBundle.getMessage(HibernateMappingCompletionManager.class, "SHORT_DESC"), // NOI18N
- "string", NbBundle.getMessage(HibernateMappingCompletionManager.class, "STRING_DESC"), // NOI18N
- "text", NbBundle.getMessage(HibernateMappingCompletionManager.class, "TEXT_DESC"), // NOI18N
- "time", NbBundle.getMessage(HibernateMappingCompletionManager.class, "TIME_DESC"), // NOI18N
- "timestamp", NbBundle.getMessage(HibernateMappingCompletionManager.class, "TIMESTAMP_DESC"), // NOI18N
- "timezone", NbBundle.getMessage(HibernateMappingCompletionManager.class, "TIMEZONE_DESC"), // NOI18N,
- "true_false", NbBundle.getMessage(HibernateMappingCompletionManager.class, "TRUE_FALSE_DESC"), // NOI18N
- "yes_no", NbBundle.getMessage(HibernateMappingCompletionManager.class, "YES_NO_DESC") // NOI18N
- // NOI18N
- };
-
- String[] cascadeStyles = new String[]{
- "none", null, // NOI18N
- "all", null, // NOI18N
- "delete", null, // NOI18N
- "delete-orphan", null, // NOI18N
- "evict", null, // NOI18N
- "refresh", null, // NOI18N
- "lock", null, // NOI18N
- "merge", null, // NOI18N
- "persist", null, // NOI18N
- "replicate", null, // NOI18N
- "save-update", null // NOI18N
- };
-
- // Items for package attribute in the root element
- Completor.JavaClassCompletor javaPackageCompletor = new Completor.JavaClassCompletor(true);
- registerCompletor(HibernateMappingXmlConstants.MAPPING_TAG, HibernateMappingXmlConstants.PACKAGE_ATTRIB, javaPackageCompletor);
-
- // Items for Id generator classes
- Completor.AttributeValueCompletor generatorCompletor = new Completor.AttributeValueCompletor(generatorClasses);
- registerCompletor(HibernateMappingXmlConstants.GENERATOR_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, generatorCompletor);
-
- // Items for Hibernate type
- Completor.AttributeValueCompletor typeCompletor = new Completor.AttributeValueCompletor(hibernateTypes);
- registerCompletor(HibernateMappingXmlConstants.PROPERTY_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.ID_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.DISCRIMINATOR_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_PROPERTY_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.VERSION_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.ELEMENT_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.MAP_KEY_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.INDEX_TAG, HibernateMappingXmlConstants.TYPE_ATTRIB, typeCompletor);
- registerCompletor(HibernateMappingXmlConstants.ANY_TAG, HibernateMappingXmlConstants.ID_TYPE_ATTRIB, typeCompletor);
-
- // Items for classes to be mapped
- Completor.JavaClassCompletor javaClassCompletor = new Completor.JavaClassCompletor(false);
- registerCompletor(HibernateMappingXmlConstants.CLASS_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.ONE_TO_MANY_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.COMPOSITE_ID_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_MANY_TO_ONE_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_ONE_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.ONE_TO_ONE_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.COMPONENT_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.SUBCLASS_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.SUBCLASS_TAG, HibernateMappingXmlConstants.EXTENDS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.JOINED_SUBCLASS_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.JOINED_SUBCLASS_TAG, HibernateMappingXmlConstants.EXTENDS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.JOINED_SUBCLASS_TAG, HibernateMappingXmlConstants.PERSISTER_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.UNION_SUBCLASS_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.UNION_SUBCLASS_TAG, HibernateMappingXmlConstants.EXTENDS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.UNION_SUBCLASS_TAG, HibernateMappingXmlConstants.PERSISTER_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.IMPORT_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_MANY_TAG, HibernateMappingXmlConstants.CLASS_ATTRIB, javaClassCompletor);
-
- // Items for properties to be mapped
- Completor.PropertyCompletor propertyCompletor = new Completor.PropertyCompletor();
- registerCompletor(HibernateMappingXmlConstants.PROPERTY_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.ID_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.SET_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.COMPOSITE_ID_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_PROPERTY_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_MANY_TO_ONE_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.VERSION_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.TIMESTAMP_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_ONE_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.ONE_TO_ONE_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.COMPONENT_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.ANY_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.MAP_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
- registerCompletor(HibernateMappingXmlConstants.LIST_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, propertyCompletor);
-
- // Items for database tables to be mapped to
- Completor.DatabaseTableCompletor databaseTableCompletor = new Completor.DatabaseTableCompletor();
- registerCompletor(HibernateMappingXmlConstants.CLASS_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateMappingXmlConstants.SET_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateMappingXmlConstants.JOINED_SUBCLASS_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateMappingXmlConstants.UNION_SUBCLASS_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateMappingXmlConstants.JOIN_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateMappingXmlConstants.MAP_TAG, HibernateMappingXmlConstants.TABLE_ATTRIB, databaseTableCompletor);
-
- // Items for database columns to be mapped to
- Completor.DatabaseTableColumnCompletor databaseColumnCompletor = new Completor.DatabaseTableColumnCompletor();
- registerCompletor(HibernateMappingXmlConstants.PROPERTY_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.ID_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.DISCRIMINATOR_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_PROPERTY_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.KEY_MANY_TO_ONE_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.VERSION_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.TIMESTAMP_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_ONE_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.COLUMN_TAG, HibernateMappingXmlConstants.NAME_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.LIST_INDEX_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.INDEX_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.MAP_KEY_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.ELEMENT_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_MANY_TAG, HibernateMappingXmlConstants.COLUMN_ATTRIB, databaseColumnCompletor);
-
- // Items for cascade attribute
- Completor.CascadeStyleCompletor cascadeStyleCompletor = new Completor.CascadeStyleCompletor(cascadeStyles);
- registerCompletor(HibernateMappingXmlConstants.MANY_TO_ONE_TAG, HibernateMappingXmlConstants.CASCADE_ATTRIB, cascadeStyleCompletor);
- registerCompletor(HibernateMappingXmlConstants.ONE_TO_ONE_TAG, HibernateMappingXmlConstants.CASCADE_ATTRIB, cascadeStyleCompletor);
- registerCompletor(HibernateMappingXmlConstants.ANY_TAG, HibernateMappingXmlConstants.CASCADE_ATTRIB, cascadeStyleCompletor);
- registerCompletor(HibernateMappingXmlConstants.MAP_TAG, HibernateMappingXmlConstants.CASCADE_ATTRIB, cascadeStyleCompletor);
- }
- private static HibernateMappingCompletionManager INSTANCE = new HibernateMappingCompletionManager();
-
- public static HibernateMappingCompletionManager getDefault() {
- return INSTANCE;
- }
-
- public int completeAttributeValues(CompletionContext context, List<HibernateCompletionItem> valueItems) {
- int anchorOffset = -1;
- if(context.getTag() == null)
- return anchorOffset;
-
- String tagName = context.getTag().getNodeName();
- Token<XMLTokenId> attrib = ContextUtilities.getAttributeToken(context.getDocumentContext());
- String attribName = attrib != null ? attrib.text().toString(): null;
-
- Completor completor = locateCompletor(tagName, attribName);
- if (completor != null) {
- valueItems.addAll(completor.doCompletion(context));
- if (completor.getAnchorOffset() != -1) {
- anchorOffset = completor.getAnchorOffset();
- }
- }
-
- return anchorOffset;
- }
-
- public int completeAttributes(CompletionContext context, List<HibernateCompletionItem> items) {
- return -1;
- }
-
- public int completeElements(CompletionContext context, List<HibernateCompletionItem> items) {
- return -1;
- }
-
- private void registerCompletor(String tagName, String attribName,
- Completor completor) {
- completors.put(createRegisteredName(tagName, attribName), completor);
- }
-
- private static String createRegisteredName(String nodeName, String attributeName) {
- StringBuilder builder = new StringBuilder();
- if (nodeName != null && nodeName.trim().length() > 0) {
- builder.append("/nodeName="); // NOI18N
- builder.append(nodeName);
- } else {
- builder.append("/nodeName="); // NOI18N
- builder.append("*"); // NOI18N
- }
-
- if (attributeName != null && attributeName.trim().length() > 0) {
- builder.append("/attribute="); // NOI18N
- builder.append(attributeName);
- }
-
- return builder.toString();
- }
-
- private Completor locateCompletor(String nodeName, String attributeName) {
- String key = createRegisteredName(nodeName, attributeName);
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- key = createRegisteredName("*", attributeName); // NOI18N
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- return null;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionProvider.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionProvider.java
deleted file mode 100644
index 2388b07..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.completion;
-
-import javax.swing.text.JTextComponent;
-import org.netbeans.spi.editor.completion.CompletionProvider;
-import org.netbeans.spi.editor.completion.CompletionTask;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
-
-/**
- * Provides the code completion for Hibernate mapping fie
- *
- * @author Dongmei Cao
- */
-public class HibernateMappingCompletionProvider implements CompletionProvider {
-
- public CompletionTask createTask(int queryType, JTextComponent component) {
- if( queryType != CompletionProvider.COMPLETION_QUERY_TYPE )
- return null;
-
- return new AsyncCompletionTask(new HibernateMappingCompletionQuery(queryType,
- component.getSelectionStart()), component);
- }
-
- public int getAutoQueryTypes(JTextComponent component, String typedText) {
- // return 0 here, meaning no query should be automatically invoked.
- // If we want some query to be invoked automatically, then a combination of the
- // COMPLETION_QUERY_TYPE,
- // COMPLETION_ALL_QUERY_TYPE,
- // DOCUMENTATION_QUERY_TYPE,
- // and TOOLTIP_QUERY_TYPE values should be returned
- return 0;
- }
-
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionQuery.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionQuery.java
deleted file mode 100644
index abab2e8..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateMappingCompletionQuery.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-import org.netbeans.modules.hibernate.completion.CompletionContext.CompletionType;
-import org.netbeans.spi.editor.completion.CompletionResultSet;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
-
-/**
- *
- * @author Dongmei Cao
- */
-public class HibernateMappingCompletionQuery extends AsyncCompletionQuery {
-
- private int queryType;
- private int caretOffset;
- private JTextComponent component;
-
- public HibernateMappingCompletionQuery(int queryType, int caretOffset) {
- this.queryType = queryType;
- this.caretOffset = caretOffset;
- }
-
- @Override
- protected void preQueryUpdate(JTextComponent component) {
- //XXX: look for invalidation conditions
- this.component = component;
- }
-
- @Override
- protected void prepareQuery(JTextComponent component) {
- this.component = component;
- }
-
- @Override
- protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
- List<HibernateCompletionItem> completionItems = new ArrayList<HibernateCompletionItem>();
- int anchorOffset = getCompletionItems(doc, caretOffset, completionItems);
- resultSet.addAllItems(completionItems);
- if(anchorOffset != -1) {
- resultSet.setAnchorOffset(anchorOffset);
- }
-
- resultSet.finish();
- }
-
- // This method is here for unit testing purpose
- int getCompletionItems(Document doc, int caretOffset, List<HibernateCompletionItem> completionItems) {
- int anchorOffset = -1;
-
- CompletionContext context = new CompletionContext(doc, caretOffset);
-
- if (context.getCompletionType() == CompletionType.NONE) {
- return anchorOffset;
- }
-
- switch (context.getCompletionType()) {
- case ATTRIBUTE_VALUE:
- anchorOffset = HibernateMappingCompletionManager.getDefault().completeAttributeValues(context, completionItems);
- break;
- case ATTRIBUTE:
- anchorOffset = HibernateMappingCompletionManager.getDefault().completeAttributes(context, completionItems);
- break;
- case TAG:
- anchorOffset = HibernateMappingCompletionManager.getDefault().completeElements(context, completionItems);
- break;
- }
-
- return anchorOffset;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionManager.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionManager.java
deleted file mode 100644
index 7f6cfab..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionManager.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import org.netbeans.modules.hibernate.editor.ContextUtilities;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-import org.netbeans.modules.hibernate.reveng.HibernateRevengXmlConstants;
-import org.openide.util.NbBundle;
-
-/**
- * This class figures out the completion items for various attributes
- *
- * @author gowri
- */
-public final class HibernateRevengCompletionManager {
-
- private static Map<String, Completor> completors = new HashMap<String, Completor>();
-
- private HibernateRevengCompletionManager() {
- setupCompletors();
- }
-
- private void setupCompletors() {
-
- // Completion items for id generator
- String[] generatorClasses = new String[]{
- "increment", NbBundle.getMessage(HibernateRevengCompletionManager.class, "INCREMENT_GENERATOR_DESC"), // NOI18N
- "identity", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IDENTITY_GENERATOR_DESC"), // NOI18N
- "sequence", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SEQUENCE_GENERATOR_DESC"), // NOI18N
- "hilo", NbBundle.getMessage(HibernateRevengCompletionManager.class, "HILO_GENERATOR_DESC"), // NOI18N
- "seqhilo", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SEQHILO_GENERATOR_DESC"), // NOI18N
- "uuid", NbBundle.getMessage(HibernateRevengCompletionManager.class, "UUID_GENERATOR_DESC"), // NOI18N
- "guid", NbBundle.getMessage(HibernateRevengCompletionManager.class, "GUID_GENERATOR_DESC"), // NOI18N
- "native", NbBundle.getMessage(HibernateRevengCompletionManager.class, "NATIVE_GENERATOR_DESC"), // NOI18N
- "assigned", NbBundle.getMessage(HibernateRevengCompletionManager.class, "ASSIGNED_GENERATOR_DESC"), // NOI18N
- "select", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SELECT_GENERATOR_DESC"), // NOI18N
- "foreign", NbBundle.getMessage(HibernateRevengCompletionManager.class, "FOREIGN_GENERATOR_DESC"), // NOI18N
- "sequence-identity", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SEQUENCE_IDENTITY_GENERATOR_DESC") // NOI18N
- // NOI18N
- // NOI18N
- // NOI18N
- };
-
- // Completion items for Hibernate type
- String[] hibernateTypes = new String[]{
- "big_decimal", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BIG_DECIMAL_DESC"), // NOI18N
- "big_integer", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BIG_INTEGER_DESC"), // NOI18N
- "binary", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BINARY_DESC"), // NOI18N
- "blob", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BLOB_DESC"), // NOI18N
- "boolean", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BOOLEAN_DESC"), // NOI18N
- "byte", NbBundle.getMessage(HibernateRevengCompletionManager.class, "BYTE_DESC"), // NOI18N
- "calendar", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CALENDAR_DESC"), // NOI18N
- "calendar_date", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CALENDAR_DATE_DESC"), // NOI18N
- "character", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CHARACTER_DESC"), // NOI18N
- "class", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CLASS_DESC"), // NOI18N
- "clob", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CLOB_DESC"), // NOI18N
- "currency", NbBundle.getMessage(HibernateRevengCompletionManager.class, "CURRENCY_DESC"), // NOI18N
- "date", NbBundle.getMessage(HibernateRevengCompletionManager.class, "DATE_DESC"), // NOI18N
- "double", NbBundle.getMessage(HibernateRevengCompletionManager.class, "DOUBLE_DESC"), // NOI18N
- "float", NbBundle.getMessage(HibernateRevengCompletionManager.class, "FLOAT_DESC"), // NOI18N
- "imm_binary", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_BINARY_DESC"), // NOI18N
- "imm_calendar", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_CALENDAR_DESC"), // NOI18N
- "imm_calendar_date", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_CALENDAR_DATE_DESC"), // NOI18N
- "imm_date", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_DATE_DESC"), // NOI18N
- "imm_serializable", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_SERIALIZABLE_DESC"), // NOI18N
- "imm_time", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_TIME_DESC"), // NOI18N
- "imm_timestamp", NbBundle.getMessage(HibernateRevengCompletionManager.class, "IMM_TIMESTAMP_DESC"), // NOI18N
- "integer", NbBundle.getMessage(HibernateRevengCompletionManager.class, "INTEGER_DESC"), // NOI18N
- "locale", NbBundle.getMessage(HibernateRevengCompletionManager.class, "LOCALE_DESC"), // NOI18N
- "long", NbBundle.getMessage(HibernateRevengCompletionManager.class, "LONG_DESC"), // NOI18N
- "serializable", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SERIALIZABLE_DESC"), // NOI18N
- "short", NbBundle.getMessage(HibernateRevengCompletionManager.class, "SHORT_DESC"), // NOI18N
- "string", NbBundle.getMessage(HibernateRevengCompletionManager.class, "STRING_DESC"), // NOI18N
- "text", NbBundle.getMessage(HibernateRevengCompletionManager.class, "TEXT_DESC"), // NOI18N
- "time", NbBundle.getMessage(HibernateRevengCompletionManager.class, "TIME_DESC"), // NOI18N
- "timestamp", NbBundle.getMessage(HibernateRevengCompletionManager.class, "TIMESTAMP_DESC"), // NOI18N
- "timezone", NbBundle.getMessage(HibernateRevengCompletionManager.class, "TIMEZONE_DESC"), // NOI18N,
- "true_false", NbBundle.getMessage(HibernateRevengCompletionManager.class, "TRUE_FALSE_DESC"), // NOI18N
- "yes_no", NbBundle.getMessage(HibernateRevengCompletionManager.class, "YES_NO_DESC") // NOI18N
- // NOI18N
- // NOI18N
- // NOI18N
- };
-
- // Items for package attribute in the root element
- Completor.JavaClassCompletor javaPackageCompletor = new Completor.JavaClassCompletor(true);
- registerCompletor(HibernateRevengXmlConstants.TABLE_FILTER_TAG, HibernateRevengXmlConstants.PACKAGE_ATTRIB, javaPackageCompletor);
-
- // Items for Id generator classes
- Completor.AttributeValueCompletor generatorCompletor = new Completor.AttributeValueCompletor(generatorClasses);
- registerCompletor(HibernateRevengXmlConstants.GENERATOR_TAG, HibernateRevengXmlConstants.CLASS_ATTRIB, generatorCompletor);
-
- // Items for Hibernate type
- Completor.AttributeValueCompletor typeCompletor = new Completor.AttributeValueCompletor(hibernateTypes);
- registerCompletor(HibernateRevengXmlConstants.SQL_TYPE_TAG, HibernateRevengXmlConstants.HIBERNATE_TYPE_ATTRIB, typeCompletor);
-
- // Items for classes to be mapped
- Completor.JavaClassCompletor javaClassCompletor = new Completor.JavaClassCompletor(false);
- registerCompletor(HibernateRevengXmlConstants.TABLE_TAG, HibernateRevengXmlConstants.CLASS_ATTRIB, javaClassCompletor);
-
- // Items for database tables to be mapped to
- Completor.DatabaseTableCompletor databaseTableCompletor = new Completor.DatabaseTableCompletor();
- registerCompletor(HibernateRevengXmlConstants.TABLE_TAG, HibernateRevengXmlConstants.NAME_ATTRIB, databaseTableCompletor);
- registerCompletor(HibernateRevengXmlConstants.TABLE_FILTER_TAG, HibernateRevengXmlConstants.MATCH_NAME_ATTRIB, databaseTableCompletor);
-
- }
- private static HibernateRevengCompletionManager INSTANCE = new HibernateRevengCompletionManager();
-
- public static HibernateRevengCompletionManager getDefault() {
- return INSTANCE;
- }
-
- public int completeAttributeValues(CompletionContext context, List<HibernateCompletionItem> valueItems) {
- int anchorOffset = -1;
- if(context.getTag() == null)
- return anchorOffset;
-
- String tagName = context.getTag().getNodeName();
- Token<XMLTokenId> attrib = ContextUtilities.getAttributeToken(context.getDocumentContext());
- String attribName = attrib != null ? attrib.text().toString(): null;
-
- Completor completor = locateCompletor(tagName, attribName);
- if (completor != null) {
- valueItems.addAll(completor.doCompletion(context));
- if (completor.getAnchorOffset() != -1) {
- anchorOffset = completor.getAnchorOffset();
- }
- }
-
- return anchorOffset;
- }
-
- public int completeAttributes(CompletionContext context, List<HibernateCompletionItem> items) {
- return -1;
- }
-
- public int completeElements(CompletionContext context, List<HibernateCompletionItem> items) {
- return -1;
- }
-
- private void registerCompletor(String tagName, String attribName,
- Completor completor) {
- completors.put(createRegisteredName(tagName, attribName), completor);
- }
-
- private static String createRegisteredName(String nodeName, String attributeName) {
- StringBuilder builder = new StringBuilder();
- if (nodeName != null && nodeName.trim().length() > 0) {
- builder.append("/nodeName="); // NOI18N
- builder.append(nodeName);
- } else {
- builder.append("/nodeName="); // NOI18N
- builder.append("*"); // NOI18N
- }
-
- if (attributeName != null && attributeName.trim().length() > 0) {
- builder.append("/attribute="); // NOI18N
- builder.append(attributeName);
- }
-
- return builder.toString();
- }
-
- private Completor locateCompletor(String nodeName, String attributeName) {
- String key = createRegisteredName(nodeName, attributeName);
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- key = createRegisteredName("*", attributeName); // NOI18N
- if (completors.containsKey(key)) {
- return completors.get(key);
- }
-
- return null;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionProvider.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionProvider.java
deleted file mode 100644
index a4974a0..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.completion;
-
-import javax.swing.text.JTextComponent;
-import org.netbeans.spi.editor.completion.CompletionProvider;
-import org.netbeans.spi.editor.completion.CompletionTask;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
-
-/**
- * Provides the code completion for Hibernate Reverse Engineering file
- *
- * @author gowri
- */
-public class HibernateRevengCompletionProvider implements CompletionProvider {
-
- public CompletionTask createTask(int queryType, JTextComponent component) {
- if( queryType != CompletionProvider.COMPLETION_QUERY_TYPE )
- return null;
-
- return new AsyncCompletionTask(new HibernateRevengCompletionQuery(queryType,
- component.getSelectionStart()), component);
- }
-
- public int getAutoQueryTypes(JTextComponent component, String typedText) {
- // return 0 here, meaning no query should be automatically invoked.
- // If we want some query to be invoked automatically, then a combination of the
- // COMPLETION_QUERY_TYPE,
- // COMPLETION_ALL_QUERY_TYPE,
- // DOCUMENTATION_QUERY_TYPE,
- // and TOOLTIP_QUERY_TYPE values should be returned
- return 0;
- }
-
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionQuery.java b/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionQuery.java
deleted file mode 100644
index 5e26eaa..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/HibernateRevengCompletionQuery.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.completion;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.swing.text.Document;
-import javax.swing.text.JTextComponent;
-import org.netbeans.modules.hibernate.completion.CompletionContext.CompletionType;
-import org.netbeans.spi.editor.completion.CompletionResultSet;
-import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
-
-/**
- *
- * @author gowri
- */
-public class HibernateRevengCompletionQuery extends AsyncCompletionQuery {
-
- private int queryType;
- private int caretOffset;
- private JTextComponent component;
-
- public HibernateRevengCompletionQuery(int queryType, int caretOffset) {
- this.queryType = queryType;
- this.caretOffset = caretOffset;
- }
-
- @Override
- protected void preQueryUpdate(JTextComponent component) {
- //XXX: look for invalidation conditions
- this.component = component;
- }
-
- @Override
- protected void prepareQuery(JTextComponent component) {
- this.component = component;
- }
-
- @Override
- protected void query(CompletionResultSet resultSet, Document doc, int caretOffset) {
- List<HibernateCompletionItem> completionItems = new ArrayList<HibernateCompletionItem>();
- int anchorOffset = getCompletionItems(doc, caretOffset, completionItems);
- resultSet.addAllItems(completionItems);
- if(anchorOffset != -1) {
- resultSet.setAnchorOffset(anchorOffset);
- }
-
- resultSet.finish();
- }
-
- // This method is here for unit testing purpose
- int getCompletionItems(Document doc, int caretOffset, List<HibernateCompletionItem> completionItems) {
- int anchorOffset = -1;
-
- CompletionContext context = new CompletionContext(doc, caretOffset);
-
- if (context.getCompletionType() == CompletionType.NONE) {
- return anchorOffset;
- }
-
- switch (context.getCompletionType()) {
- case ATTRIBUTE_VALUE:
- anchorOffset = HibernateRevengCompletionManager.getDefault().completeAttributeValues(context, completionItems);
- break;
- case ATTRIBUTE:
- anchorOffset = HibernateRevengCompletionManager.getDefault().completeAttributes(context, completionItems);
- break;
- case TAG:
- anchorOffset = HibernateRevengCompletionManager.getDefault().completeElements(context, completionItems);
- break;
- }
-
- return anchorOffset;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/completion/LazyTypeCompletionItem.java b/hibernate/src/org/netbeans/modules/hibernate/completion/LazyTypeCompletionItem.java
deleted file mode 100644
index 6b3e31f..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/completion/LazyTypeCompletionItem.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.completion;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.event.KeyEvent;
-import java.io.IOException;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.NestingKind;
-import javax.lang.model.element.TypeElement;
-import javax.swing.text.JTextComponent;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.ElementHandle;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.JavaSource.Phase;
-import org.netbeans.api.java.source.Task;
-import org.netbeans.spi.editor.completion.CompletionTask;
-import org.netbeans.spi.editor.completion.LazyCompletionItem;
-import org.netbeans.spi.editor.completion.support.CompletionUtilities;
-import org.openide.util.Exceptions;
-
-/**
- * Based on LazyTypeCompletionItem from Java Editor module
- *
- * @author Rohan Ranade (Rohan.Ranade@Sun.COM), Dongmei Cao
- */
-public class LazyTypeCompletionItem extends HibernateCompletionItem implements LazyCompletionItem {
-
- public static LazyTypeCompletionItem create(int substitutionOffset, ElementHandle<TypeElement> eh, JavaSource javaSource) {
- return new LazyTypeCompletionItem(substitutionOffset, eh, javaSource);
- }
-
- private ElementHandle<TypeElement> eh;
- private JavaSource javaSource;
- private String name;
- private HibernateCompletionItem delegate;
- private String simpleName;
- private String pkgName;
- private int prefWidth = -1;
- private String sortText;
-
- private LazyTypeCompletionItem(int substitutionOffset, ElementHandle<TypeElement> eh, JavaSource javaSource) {
- super(substitutionOffset);
- this.eh = eh;
- this.javaSource = javaSource;
- this.name = eh.getQualifiedName();
- int idx = name.lastIndexOf('.'); //NOI18N
- this.simpleName = idx > -1 ? name.substring(idx + 1) : name;
- this.pkgName = idx > -1 ? name.substring(0, idx) : ""; //NOI18N
- this.sortText = this.simpleName + HibernateCompletionItem.getImportanceLevel(this.pkgName) + "#" + this.pkgName; // NOI18N
- }
-
- public boolean accept() {
- if(eh != null) {
- try {
- javaSource.runUserActionTask(new Task<CompilationController>() {
- public void run(CompilationController cc) throws Exception {
- cc.toPhase(Phase.ELEMENTS_RESOLVED);
- TypeElement e = eh.resolve(cc);
- if (e != null && isAccessibleClass(e)) {
- delegate = HibernateCompletionItem.createTypeItem(substitutionOffset,
- e, eh, cc.getElements().isDeprecated(e), true);
- }
- eh = null;
- }
- }, true);
- } catch (IOException ioe) {
- Exceptions.printStackTrace(ioe);
- }
- }
-
- return delegate != null;
- }
-
- private static boolean isAccessibleClass(TypeElement te) {
- NestingKind nestingKind = te.getNestingKind();
- return (nestingKind == NestingKind.TOP_LEVEL) || (nestingKind == NestingKind.MEMBER && te.getModifiers().contains(Modifier.STATIC));
- }
-
- public int getSortPriority() {
- return 200;
- }
-
- public CharSequence getSortText() {
- return sortText;
- }
-
- public CharSequence getInsertPrefix() {
- return simpleName;
- }
-
- public String getDisplayText() {
- return simpleName;
- }
-
- @Override
- public CompletionTask createDocumentationTask() {
- if(delegate != null) {
- return delegate.createDocumentationTask();
- }
-
- return null;
- }
-
- @Override
- public CompletionTask createToolTipTask() {
- if(delegate != null) {
- return delegate.createToolTipTask();
- }
-
- return null;
- }
-
- @Override
- public void defaultAction(JTextComponent component) {
- if (delegate != null)
- delegate.defaultAction(component);
- }
-
- @Override
- public void processKeyEvent(KeyEvent evt) {
- if (delegate != null)
- delegate.processKeyEvent(evt);
- }
-
- @Override
- public int getPreferredWidth(Graphics g, Font defaultFont) {
- if (prefWidth < 0)
- prefWidth = CompletionUtilities.getPreferredWidth(simpleName + " (" + pkgName + ")", null, g, defaultFont); //NOI18N
- return prefWidth;
- }
-
- @Override
- public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) {
- if (delegate != null)
- delegate.render(g, defaultFont, defaultColor, backgroundColor, width, height, selected);
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/editor/Bundle.properties b/hibernate/src/org/netbeans/modules/hibernate/editor/Bundle.properties
deleted file mode 100644
index a4b5728..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/editor/Bundle.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-LBL_SourceNotFound=Source file {0} not found.
-
diff --git a/hibernate/src/org/netbeans/modules/hibernate/editor/ContextUtilities.java b/hibernate/src/org/netbeans/modules/hibernate/editor/ContextUtilities.java
deleted file mode 100644
index 1b7695b..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/editor/ContextUtilities.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.editor;
-
-import javax.swing.text.BadLocationException;
-import javax.xml.XMLConstants;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.lexer.TokenSequence;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-
-import static org.netbeans.api.xml.lexer.XMLTokenId.*;
-import org.netbeans.modules.xml.text.api.dom.SyntaxElement;
-import org.netbeans.modules.xml.text.api.dom.TagElement;
-import org.w3c.dom.Node;
-
-/**
- *
- * @author Rohan Ranade
- */
-public final class ContextUtilities {
-
- private ContextUtilities() {
- }
-
- public static boolean isValueToken(Token<XMLTokenId> currentToken) {
- if(currentToken != null) {
- if (currentToken.id() == VALUE) {
- return true;
- }
- }
-
- return false;
- }
-
- public static boolean isTagToken(Token<XMLTokenId> currentToken) {
- if(currentToken != null) {
- if (currentToken.id() == TAG) {
- return true;
- }
- }
-
- return false;
- }
-
- public static boolean isAttributeToken(Token<XMLTokenId> currentToken) {
- if(currentToken != null) {
- if (currentToken.id() == ARGUMENT) {
- return true;
- }
- }
-
- return false;
- }
-
- public static Token<XMLTokenId> getAttributeToken(DocumentContext context) {
- if(context.getCurrentToken() == null )
- return null;
- try {
- return context.<Token<XMLTokenId>>runWithSequence((TokenSequence ts) -> {
- if(!isValueToken(context.getCurrentToken())) {
- return null;
- }
- Token<XMLTokenId> equalsToken = null;
- while (ts.movePrevious()) {
- Token<XMLTokenId> t = ts.token();
- if (t.id() == OPERATOR) {
- equalsToken = t;
- break;
- }
- }
- if(equalsToken == null) {
- return null;
- }
- Token<XMLTokenId> argumentToken = null;
- while (ts.movePrevious()) {
- Token<XMLTokenId> t = ts.token();
- if (t.id() == ARGUMENT) {
- argumentToken = t;
- break;
- }
- }
- return argumentToken;
- });
- } catch (BadLocationException ex) {
- }
- return null;
- }
-
- public static String getAttributeTokenImage(DocumentContext context) {
- Token<XMLTokenId> tok = getAttributeToken(context);
- if(tok != null) {
- return tok.text().toString();
- }
-
- return null;
- }
-
- /**
- * Returns the prefix from the element's tag.
- */
- public static String getPrefixFromTag(String tagName) {
- if(tagName == null) return null;
- return (tagName.indexOf(":") == -1) ? null : // NOI18N
- tagName.substring(0, tagName.indexOf(":")); // NOI18N
- }
-
- /**
- * Returns the local name from the element's tag.
- */
- public static String getLocalNameFromTag(String tagName) {
- if(tagName == null) return null;
- return (tagName.indexOf(":") == -1) ? tagName : // NOI18N
- tagName.substring(tagName.indexOf(":")+1, tagName.length()); // NOI18N
- }
-
- /**
- * Returns any prefix declared with this namespace. For example, if
- * the namespace was declared as xmlns:po, the prefix 'po' will be returned.
- * Returns null for declaration that contains no prefix.
- */
- public static String getPrefixFromNamespaceDeclaration(String namespace) {
- if (!namespace.startsWith(XMLConstants.XMLNS_ATTRIBUTE)) return null;
- int xmlnsLength = XMLConstants.XMLNS_ATTRIBUTE.length();
- if (namespace.length() == xmlnsLength) {
- return ""; // NOI18N
- }
- if (namespace.charAt(xmlnsLength) == ':') {
- return namespace.substring(xmlnsLength + 1);
- }
- return null;
- }
-
- public static String getPrefixFromNodeName(String nodeName) {
- int colonIndex = nodeName.indexOf(':');
- if (colonIndex <= 0) {
- return null;
- }
- return nodeName.substring(0, colonIndex);
- }
-
- public static SyntaxElement getRoot(SyntaxElement se) {
- SyntaxElement root = null;
- while( se != null) {
- if(se.getType() == Node.ELEMENT_NODE &&
- ((TagElement)se).isStart()) {
- root = se;
- }
- se = se.getPrevious();
- }
-
- return root;
- }
-
-}
-
diff --git a/hibernate/src/org/netbeans/modules/hibernate/editor/DocumentContext.java b/hibernate/src/org/netbeans/modules/hibernate/editor/DocumentContext.java
deleted file mode 100644
index b66bc30..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/editor/DocumentContext.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.editor;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.Document;
-import org.netbeans.api.lexer.Token;
-import org.netbeans.api.xml.lexer.XMLTokenId;
-import org.netbeans.modules.xml.text.api.dom.SyntaxElement;
-import org.netbeans.modules.xml.text.api.dom.XMLSyntaxSupport;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Tracks context information for XML files
- *
- * @author Rohan Ranade
- */
-public class DocumentContext {
-
- //public static final String PREFIX = "ns"; //NOI18N
- //public static final String XSI_SCHEMALOCATION = "schemaLocation"; //NOI18N
- //public static final String XSI_NONS_SCHEMALOCATION = "noNamespaceSchemaLocation"; //NOI18N
-
- private static final Logger LOGGER = Logger.getLogger(DocumentContext.class.getName());
- private Document document;
- private XMLSyntaxSupport syntaxSupport;
- private int caretOffset = -1;
- private SyntaxElement element;
- private Token<XMLTokenId> token;
- private int tokenOffset;
- private boolean valid = false;
- private SyntaxElement docRoot;
- private String defaultNamespace;
- private HashMap<String, String> declaredNamespaces =
- new HashMap<String, String>();
- private String schemaLocation;
- private String noNamespaceSchemaLocation;
-
- DocumentContext(Document document) {
- this.document = document;
- try {
- this.syntaxSupport = XMLSyntaxSupport.getSyntaxSupport(document);
- } catch (ClassCastException cce) {
- LOGGER.log(Level.FINE, cce.getMessage());
- this.syntaxSupport = XMLSyntaxSupport.createSyntaxSupport(document);
- }
- }
-
- public void reset(int caretOffset) {
- this.caretOffset = caretOffset;
- initialize();
- }
-
- private void initialize() {
- declaredNamespaces.clear();
- if (syntaxSupport == null) {
- valid = false;
- return;
- }
- try {
- element = syntaxSupport.getElementChain(caretOffset);
- int[] off = new int[2];
- token = syntaxSupport.getPreviousToken(caretOffset, off);
- tokenOffset = off[0];
- this.docRoot = ContextUtilities.getRoot(element);
- populateNamespaces();
- valid = true;
- } catch (BadLocationException ex) {
- // No context support available in this case
- valid = false;
- }
- }
-
- public boolean isValid() {
- return this.valid;
- }
-
- /*
- public int getCurrentTokenId() {
- if (isValid()) {
- return token.getTokenID().getNumericID();
- } else {
- return -1;
- }
- }
- */
-
- public Token<XMLTokenId> getCurrentToken() {
- if (isValid()) {
- return token;
- } else {
- return null;
- }
- }
-
- public String getCurrentTokenImage() {
- if (isValid()) {
- return token.text().toString();
- } else {
- return null;
- }
- }
-
- public int getCurrentTokenOffset() {
- return tokenOffset;
- }
-
- public SyntaxElement getCurrentElement() {
- return this.element;
- }
- public Document getDocument() {
- return this.document;
- }
-
- public String lookupNamespacePrefix(String prefix) {
- return declaredNamespaces.get(prefix);
- }
-
- public String getNamespacePrefix(String namespace) {
- for(Entry<String, String> entry : declaredNamespaces.entrySet()) {
- if(entry.getValue().equals(namespace)) {
- return entry.getKey();
- }
- }
-
- return null;
- }
-
- public Collection<String> getDeclaredNamespaces() {
- return declaredNamespaces.values();
- }
-
- public SyntaxElement getDocRoot() {
- return docRoot;
- }
-
- public int getCaretOffset() {
- return this.caretOffset;
- }
-
- private void populateNamespaces() {
- // Find the a start or empty tag just before the current syntax element.
- SyntaxElement element = this.element;
- while (element != null && !syntaxSupport.isStartTag(element) && !syntaxSupport.isEmptyTag(element)) {
- element = element.getPrevious();
- }
- if (element == null) {
- return;
- }
-
- // To find all namespace declarations active at the caret offset, we
- // need to look at xmlns attributes of the current element and its ancestors.
- Node node = (Node)element;
- while (node != null && element != null) {
- if (syntaxSupport.isStartTag(element) || syntaxSupport.isEmptyTag(element)) {
- NamedNodeMap attributes = node.getAttributes();
- for (int index = 0; index < attributes.getLength(); index++) {
- Attr attr = (Attr) attributes.item(index);
- String attrName = attr.getName();
- String attrValue = attr.getValue();
- if (attrName == null || attrValue == null) {
- continue;
- }
- String prefix = ContextUtilities.getPrefixFromNamespaceDeclaration(attrName);
- if (prefix == null) {
- continue;
- }
- // Avoid overwriting a namespace declaration "closer" to the caret offset.
- if (!declaredNamespaces.containsKey(prefix)) {
- declaredNamespaces.put(prefix, attrValue);
- }
- }
- }
- node = node.getParentNode();
- element = syntaxSupport.getSyntaxElement(node);
- }
- }
-
- public String getNoNamespaceSchemaLocation() {
- return noNamespaceSchemaLocation;
- }
-
- public String getSchemaLocation() {
- return schemaLocation;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final DocumentContext other = (DocumentContext) obj;
- if (this.document != other.document && (this.document == null || !this.document.equals(other.document))) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- int hash = 5;
- hash = 61 * hash + (this.document != null ? this.document.hashCode() : 0);
- return hash;
- }
-
- public <T> T runWithSequence(XMLSyntaxSupport.SequenceCallable<T> callable) throws BadLocationException {
- return syntaxSupport.runWithSequence(caretOffset, callable);
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/editor/EditorContextFactory.java b/hibernate/src/org/netbeans/modules/hibernate/editor/EditorContextFactory.java
deleted file mode 100644
index 24592c1..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/editor/EditorContextFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.editor;
-
-import java.util.Map;
-import java.util.WeakHashMap;
-import javax.swing.text.Document;
-
-/**
- *
- * @author Rohan Ranade
- */
-public final class EditorContextFactory {
-// private static Map<Document, DocumentContext> contextCache =
-// new WeakHashMap<Document, DocumentContext>();
-
- public static DocumentContext getDocumentContext(Document document, int caretOffset) {
- //TODO, look if cache is useful and possible to iplemennt, see issue #221000
- DocumentContext context = new DocumentContext(document);
-
- context.reset(caretOffset);
-
- return context;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/editor/HibernateEditorUtil.java b/hibernate/src/org/netbeans/modules/hibernate/editor/HibernateEditorUtil.java
deleted file mode 100644
index ec7c9d5..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/editor/HibernateEditorUtil.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.editor;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.TypeMirror;
-import javax.lang.model.util.SimpleElementVisitor6;
-import javax.swing.text.Document;
-import org.netbeans.api.java.project.JavaProjectConstants;
-import org.netbeans.api.java.source.ClasspathInfo;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.ElementUtilities;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.Task;
-import org.netbeans.api.java.source.ui.ElementOpen;
-import org.netbeans.api.project.FileOwnerQuery;
-import org.netbeans.api.project.Project;
-import org.netbeans.api.project.ProjectUtils;
-import org.netbeans.api.project.SourceGroup;
-import org.netbeans.modules.editor.NbEditorUtilities;
-import org.openide.awt.StatusDisplayer;
-import org.openide.filesystems.FileObject;
-import org.openide.util.NbBundle;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- *
- * @author Dongmei Cao
- */
-public class HibernateEditorUtil {
-
- public static JavaSource getJavaSource(Document doc) {
- FileObject fileObject = NbEditorUtilities.getFileObject(doc);
- if (fileObject == null) {
- return null;
- }
- Project project = FileOwnerQuery.getOwner(fileObject);
- if (project == null) {
- return null;
- }
- // XXX this only works correctly with projects with a single sourcepath,
- // but we don't plan to support another kind of projects anyway (what about Maven?).
- // mkleint: Maven has just one sourceroot for java sources, the config files are placed under
- // different source root though. JavaProjectConstants.SOURCES_TYPE_RESOURCES
- SourceGroup[] sourceGroups = ProjectUtils.getSources(project).getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
- for (SourceGroup sourceGroup : sourceGroups) {
- return JavaSource.create(ClasspathInfo.create(sourceGroup.getRootFolder()));
- }
- return null;
- }
-
- public static Node getClassNode(Node tag) {
- if (tag == null) {
- return null;
- }
-
- if (tag.getNodeName().equalsIgnoreCase("class") || // NOI18N
- tag.getNodeName().equalsIgnoreCase("subclass") || // NOI18N
- tag.getNodeName().equalsIgnoreCase("joined-subclass") || // NOI18N
- tag.getNodeName().equalsIgnoreCase("union-subclass")) { // NOI18N
- return tag;
- }
-
- Node current = tag;
- while (true) {
- Node parent = current.getParentNode();
- if(parent == null) {
- // See issue 138974
- return null;
- }
- if (parent.getNodeName() == null) {
- current = parent;//#226550 some nodes may not be parsed well, just go up.
- } else if (parent.getNodeName().equalsIgnoreCase("class") || // NOI18N
- parent.getNodeName().equalsIgnoreCase("subclass") || // NOI18N
- parent.getNodeName().equalsIgnoreCase("joined-subclass") || // NOI18N
- parent.getNodeName().equalsIgnoreCase("union-subclass")) {
- // Found it
- return parent;
- } else if (parent.getNodeName().equalsIgnoreCase("hibernate-mapping")) {
- // Hit the root element
- return null;
- } else {
- // Keep going
- current = parent;
- }
- }
- }
-
- public static String getClassName(Node tag) {
- Node classNode = getClassNode(tag);
- if (classNode != null) {
- NamedNodeMap attribs = classNode.getAttributes();
- if (attribs != null && attribs.getNamedItem("name") != null) { // NOI18N
- return attribs.getNamedItem("name").getNodeValue(); // NOI18N
- }
- }
-
- return null;
- }
-
- public static String getTableName(Node tag) {
- Node classNode = getClassNode(tag);
- if (classNode != null) {
- NamedNodeMap attribs = classNode.getAttributes();
- if (attribs != null && attribs.getNamedItem("table") != null) { // NOI18N
- return attribs.getNamedItem("table").getNodeValue(); // NOI18N
- }
- }
-
- return null;
- }
-
- public static String getHbPropertyName(Node tag) {
- if (!tag.getNodeName().equalsIgnoreCase("property")) {
- return null;
- } else {
- NamedNodeMap attribs = tag.getAttributes();
- if (attribs != null && attribs.getNamedItem("name") != null) { // NOI18N
- return attribs.getNamedItem("name").getNodeValue();
- }
- }
-
- return null;
- }
-
- public static TypeElement findClassElementByBinaryName(final String binaryName, CompilationController cc) {
- if (!binaryName.contains("$")) { // NOI18N
- // fast search based on fqn
- return cc.getElements().getTypeElement(binaryName);
- } else {
- // get containing package
- String packageName = ""; // NOI18N
- int dotIndex = binaryName.lastIndexOf("."); // NOI18N
- if (dotIndex != -1) {
- packageName = binaryName.substring(0, dotIndex);
- }
- PackageElement packElem = cc.getElements().getPackageElement(packageName);
- if (packElem == null) {
- return null;
- }
-
- // scan for element matching the binaryName
- return new BinaryNameTypeScanner().visit(packElem, binaryName);
- }
- }
-
- private static class BinaryNameTypeScanner extends SimpleElementVisitor6<TypeElement, String> {
-
- @Override
- public TypeElement visitPackage(PackageElement packElem, String binaryName) {
- for (Element e : packElem.getEnclosedElements()) {
- if (e.getKind().isClass()) {
- TypeElement ret = e.accept(this, binaryName);
- if (ret != null) {
- return ret;
- }
- }
- }
-
- return null;
- }
- }
-
- public static void findAndOpenJavaClass(final String classBinaryName, Document doc) {
- final JavaSource js = getJavaSource(doc);
- if (js != null) {
- try {
- js.runUserActionTask(new Task<CompilationController>() {
-
- public void run(CompilationController cc) throws Exception {
- boolean opened = false;
- TypeElement element = findClassElementByBinaryName(classBinaryName, cc);
- if (element != null) {
- opened = ElementOpen.open(js.getClasspathInfo(), element);
- }
- if (!opened) {
- String msg = NbBundle.getMessage(HibernateEditorUtil.class, "LBL_SourceNotFound", classBinaryName);
- StatusDisplayer.getDefault().setStatusText(msg);
- }
- }
- }, false);
- } catch (IOException ex) {
- Logger.getLogger("global").log(Level.SEVERE, ex.getMessage(), ex);
- }
- }
- }
-
- public static VariableElement findFieldElementOnType(ElementUtilities eu, TypeMirror type, String fieldName) {
- FieldAcceptor fieldAcceptor = new FieldAcceptor(fieldName);
- Iterable<? extends Element> matchingProp = eu.getMembers(type, fieldAcceptor);
- Iterator<? extends Element> it = matchingProp.iterator();
-
- // no matching element found
- if (!it.hasNext()) {
- return null;
- } else
- return (VariableElement)it.next();
-
- }
-
- private static class FieldAcceptor implements ElementUtilities.ElementAcceptor {
-
- private String fieldName;
-
- public FieldAcceptor(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public boolean accept(Element e, TypeMirror type) {
-
- if (e.getKind() != ElementKind.FIELD) {
- return false;
- } else {
- if( e.getSimpleName().toString().equals(fieldName) ) {
- return true;
- }
- }
-
- return false;
- }
- }
-}
-
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLEditorController.java b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLEditorController.java
deleted file mode 100644
index 12dd15f..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLEditorController.java
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.hqleditor;
-
-import java.io.File;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.lang.model.SourceVersion;
-import javax.swing.SwingUtilities;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.StandardLocation;
-import javax.tools.ToolProvider;
-import org.dom4j.DocumentException;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.netbeans.api.db.explorer.DatabaseConnection;
-import org.netbeans.api.db.explorer.DatabaseException;
-import org.netbeans.api.db.explorer.JDBCDriver;
-import org.netbeans.api.java.source.ClasspathInfo;
-import org.netbeans.api.progress.ProgressHandle;
-import org.netbeans.api.project.FileOwnerQuery;
-import org.netbeans.api.project.Project;
-import org.netbeans.api.project.SourceGroup;
-import org.netbeans.modules.hibernate.catalog.HibernateCatalog;
-import org.netbeans.modules.hibernate.cfg.model.HibernateConfiguration;
-import org.netbeans.modules.hibernate.hqleditor.ui.HQLEditorTopComponent;
-import org.netbeans.modules.hibernate.loaders.cfg.HibernateCfgDataObject;
-import org.netbeans.modules.hibernate.service.api.HibernateEnvironment;
-import org.netbeans.modules.hibernate.util.HibernateUtil;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
-import org.openide.loaders.DataObject;
-import org.openide.loaders.DataObjectNotFoundException;
-import org.openide.nodes.Node;
-import org.openide.util.Exceptions;
-import org.openide.util.NbBundle;
-
-/**
- * HQL Editor controller. Controls overall HQL query execution.
- *
- * @author Vadiraj Deshpande (Vadiraj.Deshpande@Sun.COM)
- */
-public class HQLEditorController {
-
- private static final Logger logger = Logger.getLogger(HQLEditorController.class.getName());
- private HQLEditorTopComponent editorTopComponent = null;
-
- private enum AnnotationAccessType {
-
- FIELD_TYPE,
- METHOD_TYPE;
- };
-
- public void executeHQLQuery(final String hql,
- final FileObject configFileObject,
- final int maxRowCount,
- final ProgressHandle ph) {
- final List<URL> localResourcesURLList = new ArrayList<URL>();
-
- try {
- ph.progress(10);
- ph.setDisplayName(NbBundle.getMessage(HQLEditorTopComponent.class, "queryExecutionPrepare"));
- final Project project = FileOwnerQuery.getOwner(configFileObject);
-
- // Construct custom classpath here.
- HibernateEnvironment env = project.getLookup().lookup(HibernateEnvironment.class);
- localResourcesURLList.addAll(env.getProjectClassPath(configFileObject));
- for (FileObject mappingFO : env.getAllHibernateMappingFileObjects()) {
- localResourcesURLList.add(mappingFO.getURL());
- }
- //add jdbc driver to overloaded urls
- HibernateCfgDataObject hibernateCfgDataObject = null;
- try {
- hibernateCfgDataObject = (HibernateCfgDataObject) DataObject.find(configFileObject);
- } catch (DataObjectNotFoundException ex) {
- }
- if (hibernateCfgDataObject != null) {
- HibernateConfiguration hCfg = hibernateCfgDataObject.getHibernateConfiguration();
- DatabaseConnection dbConnection = null;
- try {
- dbConnection = HibernateUtil.getDBConnection(hCfg);
- } catch (DatabaseException ex) {
- }
- if (dbConnection != null) {
- JDBCDriver jdbcDriver = dbConnection.getJDBCDriver();
- if (jdbcDriver != null) {
- localResourcesURLList.addAll(Arrays.asList(jdbcDriver.getURLs()));
- }
- }
- }
-
- ClassLoader customClassLoader = env.getProjectClassLoader(
- localResourcesURLList.toArray(new URL[]{}));
- final ClassLoader defClassLoader = Thread.currentThread().getContextClassLoader();
- Thread t = new Thread() {
- @Override
- public void run() {
- //Thread.currentThread().setContextClassLoader(customClassLoader);
- ClassLoader customClassLoader = Thread.currentThread().getContextClassLoader();
- HQLExecutor queryExecutor = new HQLExecutor();
- HQLResult hqlResult = new HQLResult();
- try {
- // Parse POJOs from HQL
- // Check and if required compile POJO files mentioned in HQL
- SessionFactory sessionFactory = processAndConstructSessionFactory(hql, configFileObject, customClassLoader, project);
-
- ph.progress(50);
- ph.setDisplayName(NbBundle.getMessage(HQLEditorTopComponent.class, "queryExecutionPassControlToHibernate"));
- hqlResult = queryExecutor.execute(hql, sessionFactory, maxRowCount, ph);
- ph.progress(80);
- ph.setDisplayName(NbBundle.getMessage(HQLEditorTopComponent.class, "queryExecutionProcessResults"));
-
- } catch (Exception e) {
- logger.log(Level.INFO, "Problem in executing HQL", e);
- hqlResult.getExceptions().add(e);
- }
- final HQLResult hqlResult0 = hqlResult;
- final ClassLoader customClassLoader0 = customClassLoader;
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- editorTopComponent.setResult(hqlResult0, customClassLoader0);
- }
- });
-
- Thread.currentThread().setContextClassLoader(defClassLoader);
- }
- };
- t.setContextClassLoader(customClassLoader);
- t.start();
- } catch (Exception ex) {
- Exceptions.printStackTrace(ex);
- }
- }
-
- public void init(Node[] activatedNodes) {
- editorTopComponent = new HQLEditorTopComponent(this);
- editorTopComponent.open();
- editorTopComponent.requestActive();
- editorTopComponent.setFocusToEditor();
-
- editorTopComponent.fillHibernateConfigurations(activatedNodes);
- }
-
- public SessionFactory getHibernateSessionFactoryForThisContext(FileObject configFileObject,
- Set<FileObject> mappingFOList,
- List<Class> annotatedClassList,
- ClassLoader customClassLoader) throws Exception {
-
- AnnotationConfiguration customConfiguration = null;
- try {
- Class configClass = customClassLoader.loadClass("org.hibernate.cfg.AnnotationConfiguration");
- customConfiguration = (AnnotationConfiguration) configClass.newInstance();
-
- } catch (ClassNotFoundException classNotFoundException) {
- Exceptions.printStackTrace(classNotFoundException);
- } catch (InstantiationException instantiationException) {
- Exceptions.printStackTrace(instantiationException);
- } catch (IllegalAccessException illegalAccessException) {
- Exceptions.printStackTrace(illegalAccessException);
- }
-
- try {
- org.dom4j.io.SAXReader saxReader = new org.dom4j.io.SAXReader();
- saxReader.setEntityResolver(new HibernateCatalog());
- org.dom4j.Document document = saxReader.read(configFileObject.getInputStream());
- org.dom4j.Element sessionFactoryElement = document.getRootElement().element("session-factory"); //NOI18N
- Iterator mappingIterator = sessionFactoryElement.elementIterator("mapping"); //NOI18N
- while (mappingIterator.hasNext()) {
- org.dom4j.Element node = (org.dom4j.Element) mappingIterator.next();
- logger.fine("Removing mapping element .. " + node);
- node.getParent().remove(node);
- }
-
- // Fix for 142899. The actual exception generated while creating SessionFactory is not
- // catchable so this pre-check ensures that there's no exception window comes up during
- // query execution.
- String sessionName = sessionFactoryElement.attributeValue("name");
- if (sessionName != null && (!sessionName.trim().equals(""))) {
- java.util.Properties prop = new java.util.Properties();
- Iterator propertyIterator = sessionFactoryElement.elementIterator("property");
- while (propertyIterator.hasNext()) {
- org.dom4j.Element propNode = (org.dom4j.Element) propertyIterator.next();
- if (org.hibernate.cfg.Environment.JNDI_CLASS.equals(propNode.attributeValue("name"))) {
- prop.setProperty(
- javax.naming.Context.INITIAL_CONTEXT_FACTORY,
- propNode.getTextTrim());
- }
- if (org.hibernate.cfg.Environment.JNDI_URL.equals(propNode.attributeValue("name"))) {
- prop.setProperty(
- javax.naming.Context.PROVIDER_URL,
- propNode.getTextTrim());
- }
- }
-
- try {
- javax.naming.InitialContext context = new javax.naming.InitialContext(prop);
- context.bind("dummy", new Object());
- context.unbind("dummy");
- } catch (javax.naming.NamingException namingException) {
- logger.log(Level.INFO, "Incorrect JNDI properties", namingException);
- throw namingException;
- }
-
- }
-
- // End fix for 142899.
-
- // add mappings
- for (FileObject mappingFO : mappingFOList) {
- logger.info("Adding mapping to custom configuration " + mappingFO.getName());
- org.dom4j.Element mappingElement = sessionFactoryElement.addElement("mapping"); //NOI18N
- File mappingFile = FileUtil.toFile(mappingFO);
- mappingElement.addAttribute("file", mappingFile.getAbsolutePath()); //NOI18N
- }
- // add annotated pojos.
- for (Class annotatedPOJO : annotatedClassList) {
- logger.info("Adding annotated class to custom configuration " + annotatedPOJO.getName());
-
- customConfiguration.addAnnotatedClass(annotatedPOJO);
- }
-// // configure
- logger.info("configuring custom configuration..");
- customConfiguration.configure(getW3CDocument(document));
- return customConfiguration.buildSessionFactory();
- } catch (Exception e) {
- logger.log(Level.INFO, "Problem in constructing custom configuration", e);
- throw e;
- }
-
- }
-
- private org.w3c.dom.Document getW3CDocument(org.dom4j.Document document) {
- try {
- return new org.dom4j.io.DOMWriter().write(document);
- } catch (DocumentException ex) {
- Exceptions.printStackTrace(ex);
- }
- return null;
- }
-
- public SessionFactory processAndConstructSessionFactory(String hql, FileObject configFileObject,
- ClassLoader customClassLoader, Project project) throws Exception {
- HibernateEnvironment env = project.getLookup().lookup(HibernateEnvironment.class);
-
- StringTokenizer hqlTokenizer = new StringTokenizer(hql, " \n\r\f\t(),"); //NOI18N
- List<String> tokenList = new ArrayList<String>();
- while (hqlTokenizer.hasMoreTokens()) {
- tokenList.add(hqlTokenizer.nextToken());
- }
-
- // Process Mappings
- Set<FileObject> matchedMappingFOList = new HashSet<FileObject>();
- List<FileObject> mappingFOList = new ArrayList<FileObject>();
- Map<FileObject, List<String>> mappingPOJOMap = env.getAllPOJONamesFromConfiguration(configFileObject);
-
- for (FileObject mappingFO : mappingPOJOMap.keySet()) {
- List<String> pojoNameList = mappingPOJOMap.get(mappingFO);
- logger.info("pojoNameList from configuration : ");
- for (String name : pojoNameList) {
- logger.info("pojo-name " + name);
- }
-
- for (String className : pojoNameList) {
- for (String hqlClassName : tokenList) {
- if (foundClassNameMatch(hqlClassName, className)) {
- Class clazz = processMatchingClass(className, customClassLoader, project);
- logger.info("matching classname = " + className);
- logger.info("Got clazz " + clazz);
- if (clazz != null) {
- matchedMappingFOList.add(mappingFO);
- mappingFOList.add(mappingFO);
- getRelatedMappings(mappingFO, matchedMappingFOList, mappingPOJOMap);
- for (FileObject relatedMappingFO : matchedMappingFOList) {
- List<String> relatedPojoNames = mappingPOJOMap.get(relatedMappingFO);
- if (relatedPojoNames != null) {
- logger.info("Processing relationships from " + relatedMappingFO + " mapping file.");
- logger.info("Related POJOs " + relatedPojoNames);
- for (String relatedClassName : relatedPojoNames) {
- Class relatedClazz = processMatchingClass(relatedClassName, customClassLoader, project);
- logger.info("Got related POJO clazz " + relatedClazz);
- if (relatedClazz != null) {
- mappingFOList.add(relatedMappingFO);
- }
- }
- }
- }
-
- }
- }
- }
- }
- }
-
- // Process Annotated POJOs.
- List<String> annotatedPOJOClassNameList = env.getAnnotatedPOJOClassNames(configFileObject);
- List<Class> matchedAnnotatedPOJOClassNameList = new ArrayList<Class>();
- if (annotatedPOJOClassNameList.size() != 0) {
- for (String annotatedClassName : annotatedPOJOClassNameList) {
- for (String hqlClassName : tokenList) {
- if (foundClassNameMatch(hqlClassName, annotatedClassName)) {
- Class clazz = processMatchingClass(annotatedClassName, customClassLoader, project);
- logger.info("matching classname = " + annotatedClassName);
- logger.info("Got clazz " + clazz);
- if (clazz != null) {
- matchedAnnotatedPOJOClassNameList.add(clazz);
- List<Class> relatedPOJOClasses = getRelatedPOJOClasses(clazz, annotatedPOJOClassNameList, customClassLoader, project);
- logger.info("Related POJO Class list " + relatedPOJOClasses);
- matchedAnnotatedPOJOClassNameList.addAll(relatedPOJOClasses);
- }
- }
- }
- }
- }
-
- return getHibernateSessionFactoryForThisContext(
- configFileObject,
- matchedMappingFOList,
- matchedAnnotatedPOJOClassNameList,
- customClassLoader);
- }
-
- private List<Class> getRelatedPOJOClasses(Class clazz, List<String> annotatedPOJOClassNameList,
- ClassLoader ccl, Project project) {
- List<Class> relatedPOJOClasses = new ArrayList<Class>();
- getRelatedPOJOClassesByType(clazz, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- return relatedPOJOClasses;
- }
-
- private void getRelatedPOJOClassesByType(Class clazz, List<String> annotatedPOJOClassNameList, List<Class> relatedPOJOClasses,
- ClassLoader ccl, Project project) {
-
- AnnotationAccessType annotationAccessType = findAnnotationAccessType(clazz);
- if (annotationAccessType == AnnotationAccessType.METHOD_TYPE) {
- logger.info("Annotation Access type for " + clazz.getName() + " is : METHOD_TYPE");
- getRelatedPOJOClassesByMethodType(clazz, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- } else {
- logger.info("Annotation Access type for " + clazz.getName() + " is : FIELD_TYPE");
- getRelatedPOJOClassesByFieldType(clazz, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
-
- // Annotation access type can be field or method type.
- // Determines by the position of @Id or @EmbeddedId.
- private AnnotationAccessType findAnnotationAccessType(Class clazz) {
-
- for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
- if (field.isAnnotationPresent(javax.persistence.Id.class)
- || field.isAnnotationPresent(javax.persistence.EmbeddedId.class)) {
- return AnnotationAccessType.FIELD_TYPE;
- }
- }
- return AnnotationAccessType.METHOD_TYPE;
- }
-
- private void getRelatedPOJOClassesByMethodType(Class clazz, List<String> annotatedPOJOClassNameList, List<Class> relatedPOJOClasses,
- ClassLoader ccl, Project project) {
-
- for (java.lang.reflect.Method m : clazz.getMethods()) {
- if (m.isAnnotationPresent(javax.persistence.ManyToOne.class) || m.isAnnotationPresent(javax.persistence.OneToOne.class)
- || m.isAnnotationPresent(javax.persistence.OneToMany.class)) {
- logger.info("Found relationship in " + m.getName() + " method of " + clazz.getName() + " related POJO.");
- try {
- Class relatedPOJOClass = m.getReturnType();
- // Check for Java collection and Map types.
- if (java.util.Collection.class.isAssignableFrom(relatedPOJOClass)) {
- try {
- Class returnClassType = (Class) ((java.lang.reflect.ParameterizedType) m.getGenericReturnType()).getActualTypeArguments()[0];
- logger.info("Method return type is java.util.Collection");
- if (!returnClassType.equals(java.lang.Object.class)) {
- logger.info("Re-assigning related class to " + returnClassType);
- relatedPOJOClass = returnClassType;
- }
- } catch (Exception ex) {
- Exceptions.printStackTrace(ex);
- }
- } else if (java.util.Map.class.isAssignableFrom(relatedPOJOClass)) {
- logger.info("Accessor method return type is java.util.Map");
- }
-
- if (annotatedPOJOClassNameList.contains(relatedPOJOClass.getName())) {
- logger.info("Related POJO Class " + relatedPOJOClass.getName());
- if (relatedPOJOClasses.contains(relatedPOJOClass)) {
- logger.info("Already processed " + relatedPOJOClass + ". Skipping.");
- continue;
- }
- logger.info("adding to related POJO class list " + relatedPOJOClass);
- relatedPOJOClasses.add(relatedPOJOClass);
- getRelatedPOJOClassesByType(relatedPOJOClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
-
- }
- // Add other side classes of relation, if targetEntity defined.
- javax.persistence.OneToMany oneToManyAnnotation = m.getAnnotation(javax.persistence.OneToMany.class);
- if (oneToManyAnnotation != null) {
- Class targetEntityClass = oneToManyAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (relatedPOJOClasses.contains(targetEntityClass)) {
- // Already processed class
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
- }
-
- javax.persistence.ManyToOne manyToOneAnnotation = m.getAnnotation(javax.persistence.ManyToOne.class);
- if (manyToOneAnnotation != null) {
- Class targetEntityClass = manyToOneAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (relatedPOJOClasses.contains(targetEntityClass)) {
- // Already processed class
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
- }
- javax.persistence.OneToOne oneToOneAnnotation = m.getAnnotation(javax.persistence.OneToOne.class);
- if (oneToOneAnnotation != null) {
- Class targetEntityClass = oneToOneAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (relatedPOJOClasses.contains(targetEntityClass)) {
- // Already processed class
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
- }
- } catch (IllegalArgumentException illegalArgumentException) {
- logger.log(Level.INFO, "Accessor method is not annotated", illegalArgumentException);
- }
-
- }
- }
- }
-
- private void getRelatedPOJOClassesByFieldType(Class clazz, List<String> annotatedPOJOClassNameList,
- List<Class> relatedPOJOClasses, ClassLoader ccl, Project project) {
- // Process declared variables.
- for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
- if (field.isAnnotationPresent(javax.persistence.ManyToOne.class) || field.isAnnotationPresent(javax.persistence.OneToOne.class)
- || field.isAnnotationPresent(javax.persistence.OneToMany.class)) {
- logger.info("Found relationship in " + field.getName() + " field of " + clazz.getName() + " related POJO.");
- try {
- Class relatedPOJOClass = field.getType();
- // Check for Java collection and Map types.
- if (java.util.Collection.class.isAssignableFrom(relatedPOJOClass)) {
- try {
- Class returnClassType = (Class) ((java.lang.reflect.ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
- logger.info("Field type is java.util.Collection");
- if (!returnClassType.equals(java.lang.Object.class)) {
- logger.info("Re-assigning related class to " + returnClassType);
- relatedPOJOClass = returnClassType;
- }
- } catch (Exception ex) {
- Exceptions.printStackTrace(ex);
- }
- } else if (java.util.Map.class.isAssignableFrom(relatedPOJOClass)) {
- logger.info("Field type is java.util.Map");
- }
-
- if (annotatedPOJOClassNameList.contains(relatedPOJOClass.getName())) {
- logger.info("Related POJO Class " + relatedPOJOClass.getName());
- if (relatedPOJOClasses.contains(relatedPOJOClass)) {
- logger.info("Already processed " + relatedPOJOClass + ". Skipping.");
- continue;
- }
- logger.info("adding to related POJO class list " + relatedPOJOClass);
- relatedPOJOClasses.add(relatedPOJOClass);
- getRelatedPOJOClassesByType(relatedPOJOClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
-
- }
- // Add other side classes of relation, if targetEntity defined.
- javax.persistence.OneToMany oneToManyAnnotation = field.getAnnotation(javax.persistence.OneToMany.class);
- if (oneToManyAnnotation != null) {
- Class targetEntityClass = oneToManyAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (relatedPOJOClasses.contains(targetEntityClass)) {
- // Already processed class
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
- }
-
- javax.persistence.ManyToOne manyToOneAnnotation = field.getAnnotation(javax.persistence.ManyToOne.class);
- if (manyToOneAnnotation != null) {
- Class targetEntityClass = manyToOneAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (!relatedPOJOClasses.contains(targetEntityClass)) {
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- } else {
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- } else {
- // No targetEntity defined.
- }
- }
- javax.persistence.OneToOne oneToOneAnnotation = field.getAnnotation(javax.persistence.OneToOne.class);
- if (oneToOneAnnotation != null) {
- Class targetEntityClass = oneToOneAnnotation.targetEntity();
- if (targetEntityClass != null && (!targetEntityClass.getName().equals("void"))) {
- if (relatedPOJOClasses.contains(targetEntityClass)) {
- // Already processed class
- logger.info("Already processed " + targetEntityClass + ". Skipping.");
- continue;
- }
- targetEntityClass = processMatchingClass(targetEntityClass.getName(), ccl, project);
- if (targetEntityClass != null) {
- logger.info("adding to related POJO class list from targetEntity : " + targetEntityClass);
- relatedPOJOClasses.add(targetEntityClass);
- getRelatedPOJOClassesByType(targetEntityClass, annotatedPOJOClassNameList, relatedPOJOClasses, ccl, project);
- }
- }
- }
- } catch (IllegalArgumentException illegalArgumentException) {
- logger.log(Level.INFO, "Field is not annotated", illegalArgumentException);
- }
-
- }
- }
- }
-
- private Set<FileObject> getRelatedMappings(FileObject mappingFO, Set<FileObject> relatedMappings, Map<FileObject, List<String>> mappingPOJOMap) {
- try {
- org.dom4j.io.SAXReader xmlReader = new org.dom4j.io.SAXReader();
- xmlReader.setEntityResolver(new HibernateCatalog());
- org.dom4j.Document document = xmlReader.read(FileUtil.toFile(mappingFO));
- Iterator classElementIterator = document.getRootElement().elementIterator("class");
- while (classElementIterator.hasNext()) {
- org.dom4j.Element classElement = (org.dom4j.Element) classElementIterator.next();
- logger.info("Processing many-to-one");
- processMappingRelationships(classElement.elementIterator("many-to-one"), relatedMappings, mappingPOJOMap);
- logger.info("Processing one-to-one");
- processMappingRelationships(classElement.elementIterator("one-to-one"), relatedMappings, mappingPOJOMap);
- logger.info("Processing set");
- processMappingRelationships(classElement.elementIterator("set"), relatedMappings, mappingPOJOMap);
- logger.info("Processing idbag");
- processMappingRelationships(classElement.elementIterator("idbag"), relatedMappings, mappingPOJOMap);
- logger.info("Processing map");
- processMappingRelationships(classElement.elementIterator("map"), relatedMappings, mappingPOJOMap);
- logger.info("Processing bag");
- processMappingRelationships(classElement.elementIterator("bag"), relatedMappings, mappingPOJOMap);
- logger.info("Processing list");
- processMappingRelationships(classElement.elementIterator("list"), relatedMappings, mappingPOJOMap);
- logger.info("Processing array");
- processMappingRelationships(classElement.elementIterator("array"), relatedMappings, mappingPOJOMap);
-
- }
- } catch (Exception e) {
- logger.log(Level.INFO, "Problem in parsing mapping file for relation", e);
- }
-
- return relatedMappings;
- }
-
- private Set<FileObject> processMappingRelationships(Iterator relationshipIterator, Set<FileObject> relatedMappings, Map<FileObject, List<String>> mappingPOJOMap) {
- while (relationshipIterator.hasNext()) {
- org.dom4j.Element relationshipElement = (org.dom4j.Element) relationshipIterator.next();
- String pojoName = relationshipElement.attributeValue("class");
- if (pojoName == null) {
- // Check for Collection based relationship types.
- org.dom4j.Element connectionTypeElement = relationshipElement.element("one-to-many");
- if (connectionTypeElement == null) {
- connectionTypeElement = relationshipElement.element("composite-element");
- }
- if (connectionTypeElement == null) {
- connectionTypeElement = relationshipElement.element("one-to-many");
- }
- if (connectionTypeElement == null) {
- connectionTypeElement = relationshipElement.element("many-to-many");
- }
- if (connectionTypeElement != null) {
- pojoName = connectionTypeElement.attributeValue("class");
- }
- }
- FileObject relatedMappingFO = findRelatedMappingFO(pojoName, mappingPOJOMap);
- if (relatedMappingFO != null && (!relatedMappings.contains(relatedMappingFO))) {
- relatedMappings.add(relatedMappingFO);
- getRelatedMappings(relatedMappingFO, relatedMappings, mappingPOJOMap);
- }
- }
- logger.info("Related mapping files : " + relatedMappings);
- return relatedMappings;
- }
-
- private FileObject findRelatedMappingFO(String pojoName, Map<FileObject, List<String>> mappingPOJOMap) {
- for (FileObject mappingFile : mappingPOJOMap.keySet()) {
- List<String> pojoNameList = mappingPOJOMap.get(mappingFile);
- if (pojoNameList.contains(pojoName)) {
- logger.info("Related POJO : " + pojoName);
- return mappingFile;
- }
- }
- return null; // mapping file not found.
- }
-
- private boolean foundClassNameMatch(String hqlClassName, String className) {
- boolean foundMatch = false;
- if (hqlClassName.indexOf(".") != -1) {
- if (className.endsWith(hqlClassName)) {
- foundMatch = true;
- }
- } else {
- if (className.indexOf(".") == -1) {
- if (className.equals(hqlClassName)) {
- foundMatch = true;
- }
- } else {
- String actualClassName = className.substring(className.lastIndexOf(".") + 1);
- if (actualClassName.equals(hqlClassName)) {
- foundMatch = true;
- }
- }
- }
- return foundMatch;
- }
-
- private Class processMatchingClass(String className, ClassLoader customClassLoader, Project project) {
- FileObject clazzFO = HibernateUtil.findJavaFileObjectInProject(className, project);
- FileObject buildFolderFO = HibernateUtil.getBuildFO(project);
- if (clazzFO == null || buildFolderFO == null) {
- return null; // Unable to find the class or the build folder.
- }
- return checkAndCompile(className, clazzFO, buildFolderFO, customClassLoader, project);
- }
-
- private Class checkAndCompile(String className, FileObject sourceFO, FileObject buildFolderFO, ClassLoader customClassLoader, Project project) {
- Class clazz = null;
-
- try {
- clazz = customClassLoader.loadClass(className);
- if (clazz != null) {
- logger.info("Found pre-existing class. Returning.." + clazz.getName());
- return clazz;
- }
- } catch (ClassNotFoundException e) {
- // Compile the class here.
- logger.info("CNF. Processing .. " + className);
-
- try {
- JavaCompiler javaCompiler = null;
- ClassLoader orig = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(ClasspathInfo.class.getClassLoader());
- javaCompiler = ToolProvider.getSystemJavaCompiler();
- } finally {
- Thread.currentThread().setContextClassLoader(orig);
- }
- StandardJavaFileManager fileManager = javaCompiler.getStandardFileManager(null, null, null);
- className = className.replace(".", File.separator);
-
- File sourceFile = FileUtil.toFile(sourceFO);
-
- Iterable<? extends JavaFileObject> compilationUnits =
- fileManager.getJavaFileObjectsFromFiles(Arrays.asList(new File[]{sourceFile}));
- List<File> outputPath = new ArrayList<File>();
- outputPath.add(FileUtil.toFile(buildFolderFO));
- List<File> sourcePath = new ArrayList<File>();
- for (SourceGroup sourceGroup : HibernateUtil.getSourceGroups(project)) {
- sourcePath.add(
- FileUtil.toFile(sourceGroup.getRootFolder()));
- }
- fileManager.setLocation(StandardLocation.CLASS_OUTPUT, outputPath);
- fileManager.setLocation(StandardLocation.CLASS_PATH, getProjectClasspath(project, sourceFO));
- fileManager.setLocation(StandardLocation.SOURCE_PATH, sourcePath);
- List<String> options = new ArrayList<String>();
- options.add("-target"); //NOI18N
- final SourceVersion runtimeSourceVersion = getRuntimeSourceVersion();
- final SourceVersion nbJavacSourceVersion = SourceVersion.latest();
- if (runtimeSourceVersion.compareTo(nbJavacSourceVersion) <= 0) {
- options.add(sourceVersionToString(runtimeSourceVersion));
- } else {
- options.add(sourceVersionToString(nbJavacSourceVersion));
- }
-
- // for some reason the following is not working.. Bug in JavaC API?
-// options.add("-classpath");
-// options = addClasspath(project, sourceFO, options);
- //TODO diagnostic listener - plugin log
- Boolean b = javaCompiler.getTask(null, fileManager, null, options, null, compilationUnits).call();
- logger.info("b = " + b);
- if (b == false) { // Compilation errors.
- FileObject classfileFO = buildFolderFO.getFileObject(className + ".class");
- if (classfileFO != null && classfileFO.isValid()) {
- classfileFO.delete();
- }
- return clazz;
- }
- try {
- className = className.replace(File.separator, ".");
- clazz = customClassLoader.loadClass(className);
- if (clazz != null) {
- logger.info("Found class after processing. Returning.." + clazz.getName());
- return clazz;
- }
- } catch (ClassNotFoundException ee) {
- logger.info("CNF after processing.. " + className);
- Exceptions.printStackTrace(ee);
- }
- // Ant approach -- commented out for future use.
- // FileObject buildXMLFileObject = project.getProjectDirectory().getFileObject("build", "xml");
- // java.util.Properties p = new java.util.Properties();
- // p.setProperty("javac.includes", ActionUtils.antIncludesList(
- // files,
- // configFileObject,
- // recursive));
- // ExecutorTask task = ActionUtils.runTarget(buildXMLFileObject, new String[]{"compile-single"}, p);
- // InputOutput io = task.getInputOutput();
- //io.
- // int r = task.result();
- // System.out.println("result = " + r);
- } catch (Exception ee) {
- Exceptions.printStackTrace(ee);
- }
-
- }
- return clazz;
- }
-
- private List<File> getProjectClasspath(Project project, FileObject sourceFO) {
- List<File> cpEntries = new ArrayList<File>();
- HibernateEnvironment env = (HibernateEnvironment) project.getLookup().lookup(HibernateEnvironment.class);
- List<URL> urls = env.getProjectClassPath(sourceFO);
- //no deed to extend with jdbc as it's used in compile and jdbc should be by default if it's used in any compilation
- for (URL url : urls) {
- String cpEntry = url.getPath();
- cpEntry = cpEntry.replace("file:", "");
- cpEntry = cpEntry.replace("!/", "");
- File f = new File(cpEntry);
- cpEntries.add(f);
- }
- logger.info("Adding classpath " + cpEntries);
- return cpEntries;
- }
-
- private static SourceVersion getRuntimeSourceVersion() {
- final String specVer = System.getProperty("java.specification.version", ""); //NOI18N
- final String parts[] = specVer.split("\\."); //NOI18N
- try {
- int major;
- int minor;
- if (parts.length == 1) {
- major = Integer.parseInt(parts[0]);
- minor = 0;
- } else if (parts.length == 2) {
- major = Integer.parseInt(parts[0]);
- minor = Integer.parseInt(parts[1]);
- } else {
- return SourceVersion.RELEASE_5;
- }
- final SourceVersion[] sourceVersions = SourceVersion.values();
- do {
- final int ordinal = major >= 9 ? major : minor;
- if (sourceVersions.length > ordinal) {
- return sourceVersions[ordinal];
- }
- //Downgrade
- if (major > 9) {
- major -= 1;
- } else if (major == 9) {
- major = 1;
- minor = 8;
- } else {
- minor -= 1;
- }
- } while ((major > 1) || (minor >= 0));
- } catch (NumberFormatException e) {
- logger.log(
- Level.WARNING,
- "Invalid java.specification.version: {0}, using 1.5", //NOI18N
- specVer);
- }
- return SourceVersion.RELEASE_5;
- }
-
- private static String sourceVersionToString(final SourceVersion sv) {
- return Integer.toString(sv.ordinal());
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLExecutor.java b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLExecutor.java
deleted file mode 100644
index d3b260f..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLExecutor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.hqleditor;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.netbeans.api.progress.ProgressHandle;
-
-/**
- * Executes HQL query.
- *
- * @author Vadiraj Deshpande (Vadiraj.Deshpande@Sun.COM)
- */
-public class HQLExecutor {
-
- /**
- * Executes given HQL query and returns the result.
- * @param hql the query
- * @param configFileObject hibernate configuration object.
- * @return HQLResult containing the execution result (including any errors).
- */
- public HQLResult execute(String hql,
- SessionFactory sessionFactory,
- int maxRowCount,
- ProgressHandle ph) {
- HQLResult result = new HQLResult();
- try {
- ph.progress(60);
-
- Session session = sessionFactory.openSession();
- session.beginTransaction();
-
- ph.progress(70);
-
- Query query = session.createQuery(hql);
- query.setMaxResults(maxRowCount);
-
- hql = hql.trim();
- hql = hql.toUpperCase();
-
- if (hql.startsWith("UPDATE") || hql.startsWith("DELETE")) { //NOI18N
- result.setUpdateOrDeleteResult(query.executeUpdate());
- } else {
- result.setQueryResults(query.list());
- }
-
- session.getTransaction().commit();
-
- } catch (Exception e) {
- result.getExceptions().add(e);
- }
- return result;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLResult.java b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLResult.java
deleted file mode 100644
index 175390b..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/HQLResult.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.hibernate.hqleditor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Wraps HQL execution results and errors.
- *
- * @author Vadiraj Deshpande (Vadiraj.Deshpande@Sun.COM)
- */
-public class HQLResult {
- private List results = new ArrayList();
- private int updateOrDeleteResult;
- private List<Throwable> exceptions = new ArrayList<Throwable>();
-
- public List<Throwable> getExceptions() {
- return exceptions;
- }
-
- public void setExceptions(List<Throwable> exceptions) {
- this.exceptions = exceptions;
- }
-
- public int getUpdateOrDeleteResult() {
- return updateOrDeleteResult;
- }
-
- public void setUpdateOrDeleteResult(int updateOrDeleteResult) {
- this.updateOrDeleteResult = updateOrDeleteResult;
- }
-
- public void setQueryResults(List results) {
- this.results = results;
- }
-
- public List getQueryResults() {
- return results;
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties
deleted file mode 100644
index b5344ae..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties
+++ /dev/null
@@ -1,53 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-CTL_HQLEditorAction=Run HQL Query
-CTL_HQLEditorTopComponent=HQL Query
-CTL_RUN_HQL_COMMAND=Run HQL
-CTL_CUT_COMMAND = Cut
-CTL_COPY_COMMAND = Copy
-CTL_PASTE_COMMAND = Paste
-CTL_SELECT_ALL_COMMAND = Select All
-HINT_HQLEditorTopComponent=This is a HQL Query window
-HQLEditorTopComponent.runHQLButton.text=
-HQLEditorTopComponent.resultToggleButton.text=Result
-HQLEditorTopComponent.sqlToggleButton.text=SQL
-HQLEditorTopComponent.sessionLabel.text=Session:
-HQLEditorTopComponent.statusLabel.text=
-# Query processing messages.
-progressTaskname=HQL Query Execution
-emptyQuery=No Query.
-emptyConfiguration=Empty configuration. Re-open the HQL Editor on a valid configuration file.
-queryExecutionPrepare=Preparing...
-queryExecutionPassControlToHibernate=Executing Query...
-queryExecutionProcessResults=Processing Results..
-queryExecutionDone=Done
-queryUpdatedOrDeleted=row(s) updated.
-rowsSelected=row(s) selected.
-queryExecutionError=Exception in Query Execution
-runHQLQueryButtonToolTip=Run HQL Query
-HQLEditorTopComponent.setMaxRowCountLabel.text=Set Max. Row Count:
-setMaxRowToolTip=Set the Maximum number of rows to fetch
-showSQLTooltipText=Show SQL
-showResultTooltipText=Show Query Execution Result
-#On-the-fly SQL messages
-MalformedQuery=Invalid Query.
-DbError=Unable to retrieve data from the database.
-GeneralError=General Error
-
-queryResultDefaultColumnName=Column
\ No newline at end of file
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorAction.java b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorAction.java
deleted file mode 100644
index b59bc2c..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.hqleditor.ui;
-
-import org.netbeans.modules.hibernate.hqleditor.HQLEditorController;
-import org.openide.nodes.Node;
-import org.openide.util.HelpCtx;
-import org.openide.util.NbBundle;
-import org.openide.util.actions.NodeAction;
-
-/**
- * Action which shows HQLEditor component.
- *
- * @author Vadiraj Deshpande (Vadiraj.Deshpande@Sun.COM)
- */
-public class HQLEditorAction extends NodeAction {
-
- public HQLEditorAction() {
- super();
- }
-
- @Override
- protected boolean asynchronous() {
- return false;
- }
-
- @Override
- protected void performAction(final Node[] activatedNodes) {
- new HQLEditorController().init(activatedNodes);
- }
-
- @Override
- protected boolean enable(Node[] activatedNodes) {
- return true;
- }
-
- public HelpCtx getHelpCtx() {
- return HelpCtx.DEFAULT_HELP;
- }
-
- public String getName() {
- return NbBundle.getMessage(HQLEditorAction.class, "CTL_HQLEditorAction");
- }
-}
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.form b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.form
deleted file mode 100644
index 5f3aed6..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.form
+++ /dev/null
@@ -1,426 +0,0 @@
-<?xml version="1.1" encoding="UTF-8" ?>
-
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-<Form version="1.4" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
- <AuxValues>
- <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
- <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
- <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
- <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
- <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
- </AuxValues>
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="toolBar" alignment="0" pref="607" max="32767" attributes="0"/>
- <Component id="splitPane" alignment="0" pref="607" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="0" attributes="0">
- <Component id="toolBar" min="-2" pref="25" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="splitPane" pref="508" max="32767" attributes="0"/>
- </Group>
- </Group>
- </DimensionLayout>
- </Layout>
- <SubComponents>
- <Container class="javax.swing.JToolBar" name="toolBar">
- <Properties>
- <Property name="floatable" type="boolean" value="false"/>
- <Property name="rollover" type="boolean" value="true"/>
- </Properties>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
- <SubComponents>
- <Component class="javax.swing.JLabel" name="sessionLabel">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.sessionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JComboBox" name="hibernateConfigurationComboBox">
- <Properties>
- <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
- <StringArray count="0"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JToolBar$Separator" name="toolbarSeparator">
- </Component>
- <Component class="javax.swing.JButton" name="runHQLButton">
- <Properties>
- <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
- <Image iconType="3" name="/org/netbeans/modules/hibernate/hqleditor/ui/resources/run_hql_query_16.png"/>
- </Property>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.runHQLButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="runHQLQueryButtonToolTip" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="focusable" type="boolean" value="false"/>
- <Property name="horizontalTextPosition" type="int" value="0"/>
- <Property name="verticalTextPosition" type="int" value="3"/>
- </Properties>
- <Events>
- <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="runHQLButtonActionPerformed"/>
- </Events>
- </Component>
- <Component class="javax.swing.JToolBar$Separator" name="toolbarSeparator1">
- <Properties>
- <Property name="separatorSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="[300, 10]"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JSplitPane" name="splitPane">
- <Properties>
- <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
- <Border info="null"/>
- </Property>
- <Property name="dividerLocation" type="int" value="180"/>
- <Property name="dividerSize" type="int" value="7"/>
- <Property name="orientation" type="int" value="0"/>
- </Properties>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
- <SubComponents>
- <Container class="javax.swing.JScrollPane" name="jScrollPane1">
- <AuxValues>
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
- </AuxValues>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
- <JSplitPaneConstraints position="top"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
- <SubComponents>
- <Component class="javax.swing.JEditorPane" name="hqlEditor">
- <Properties>
- <Property name="contentType" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
- <Connection code=""text/x-hql"" type="code"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JPanel" name="containerPanel">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
- <JSplitPaneConstraints position="right"/>
- </Constraint>
- </Constraints>
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="toolBar2" alignment="0" pref="607" max="32767" attributes="0"/>
- <Component id="executionPanel" alignment="0" pref="607" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="0" attributes="0">
- <Component id="toolBar2" min="-2" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="executionPanel" pref="286" max="32767" attributes="0"/>
- </Group>
- </Group>
- </DimensionLayout>
- </Layout>
- <SubComponents>
- <Container class="javax.swing.JToolBar" name="toolBar2">
- <Properties>
- <Property name="floatable" type="boolean" value="false"/>
- <Property name="rollover" type="boolean" value="true"/>
- </Properties>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
- <SubComponents>
- <Component class="javax.swing.JToggleButton" name="resultToggleButton">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.resultToggleButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="showResultTooltipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="focusable" type="boolean" value="false"/>
- <Property name="horizontalTextPosition" type="int" value="0"/>
- <Property name="verticalTextPosition" type="int" value="3"/>
- </Properties>
- <Events>
- <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="resultToggleButtonItemStateChanged"/>
- </Events>
- </Component>
- <Component class="javax.swing.JToggleButton" name="sqlToggleButton">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.sqlToggleButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="showSQLTooltipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- <Property name="horizontalTextPosition" type="int" value="0"/>
- <Property name="verticalTextPosition" type="int" value="3"/>
- </Properties>
- <Events>
- <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="sqlToggleButtonItemStateChanged"/>
- </Events>
- </Component>
- <Container class="javax.swing.JPanel" name="spacerPanel1">
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="224" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="27" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- </Layout>
- </Container>
- <Container class="javax.swing.JPanel" name="spacerPanel2">
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="150" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="27" max="32767" attributes="0"/>
- </Group>
- </DimensionLayout>
- </Layout>
- </Container>
- <Container class="javax.swing.JPanel" name="setMaxRowCountPanel">
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="0" attributes="0">
- <Component id="setMaxRowCountLabel" min="-2" max="-2" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- <Component id="setMaxRowCountComboBox" min="-2" max="-2" attributes="0"/>
- </Group>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="103" alignment="0" groupAlignment="3" attributes="0">
- <Component id="setMaxRowCountLabel" alignment="3" min="-2" max="-2" attributes="0"/>
- <Component id="setMaxRowCountComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
- </Group>
- </Group>
- </DimensionLayout>
- </Layout>
- <SubComponents>
- <Component class="javax.swing.JLabel" name="setMaxRowCountLabel">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.setMaxRowCountLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- </Properties>
- </Component>
- <Component class="javax.swing.JComboBox" name="setMaxRowCountComboBox">
- <Properties>
- <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
- <StringArray count="4">
- <StringItem index="0" value="100"/>
- <StringItem index="1" value="1000"/>
- <StringItem index="2" value="10000"/>
- <StringItem index="3" value="100000"/>
- </StringArray>
- </Property>
- <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="setMaxRowToolTip" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JPanel" name="executionPanel">
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
- <SubComponents>
- <Container class="javax.swing.JPanel" name="resultContainerPanel">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
- <CardConstraints cardName="card2"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
- <SubComponents>
- <Container class="javax.swing.JPanel" name="statusPanel">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
- <BorderConstraints direction="North"/>
- </Constraint>
- </Constraints>
-
- <Layout>
- <DimensionLayout dim="0">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="607" max="32767" attributes="0"/>
- <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <EmptySpace min="0" pref="303" max="32767" attributes="0"/>
- <Component id="statusLabel" min="-2" max="-2" attributes="0"/>
- <EmptySpace min="0" pref="304" max="32767" attributes="0"/>
- </Group>
- </Group>
- </Group>
- </DimensionLayout>
- <DimensionLayout dim="1">
- <Group type="103" groupAlignment="0" attributes="0">
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
- <Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
- <Component id="statusLabel" min="-2" max="-2" attributes="0"/>
- <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
- </Group>
- </Group>
- </Group>
- </DimensionLayout>
- </Layout>
- <SubComponents>
- <Component class="javax.swing.JLabel" name="statusLabel">
- <Properties>
- <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
- <ResourceString bundle="org/netbeans/modules/hibernate/hqleditor/ui/Bundle.properties" key="HQLEditorTopComponent.statusLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
- </Property>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JPanel" name="resultsOrErrorPanel">
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
- <BorderConstraints direction="Center"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.DesignCardLayout"/>
- <SubComponents>
- <Container class="javax.swing.JScrollPane" name="jScrollPane4">
- <AuxValues>
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
- </AuxValues>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
- <CardConstraints cardName="card2"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
- <SubComponents>
- <Component class="javax.swing.JTextArea" name="errorTextArea">
- <Properties>
- <Property name="columns" type="int" value="20"/>
- <Property name="editable" type="boolean" value="false"/>
- <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
- <Color blue="66" green="66" red="ff" type="rgb"/>
- </Property>
- <Property name="rows" type="int" value="5"/>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JScrollPane" name="jScrollPane3">
- <AuxValues>
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
- </AuxValues>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
- <CardConstraints cardName="card3"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
- <SubComponents>
- <Component class="javax.swing.JTable" name="resultsTable">
- <Properties>
- <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
- <Table columnCount="0" rowCount="4"/>
- </Property>
- <Property name="autoResizeMode" type="int" value="0"/>
- </Properties>
- <AuxValues>
- <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new javax.swing.JTable() {
 public java.awt.Dimension getPreferredScrollableViewportSize()
{
 java.awt.Dimension size = super.getPreferredScrollableViewportSize();
 return new java.awt.Dimension(Math.min(getPreferredSize().width, size.width), size.height);
}
}"/>
- </AuxValues>
- </Component>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- <Container class="javax.swing.JScrollPane" name="jScrollPane2">
- <AuxValues>
- <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
- </AuxValues>
- <Constraints>
- <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignCardLayout" value="org.netbeans.modules.form.compat2.layouts.DesignCardLayout$CardConstraintsDescription">
- <CardConstraints cardName="card1"/>
- </Constraint>
- </Constraints>
-
- <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
- <SubComponents>
- <Component class="javax.swing.JTextPane" name="sqlEditorPane">
- <Properties>
- <Property name="editable" type="boolean" value="false"/>
- </Properties>
- </Component>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- </SubComponents>
- </Container>
- </SubComponents>
-</Form>
diff --git a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.java b/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.java
deleted file mode 100644
index fe7b215..0000000
--- a/hibernate/src/org/netbeans/modules/hibernate/hqleditor/ui/HQLEditorTopComponent.java
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.hibernate.hqleditor.ui;
-
-import java.awt.CardLayout;
-import java.awt.Toolkit;
-import java.awt.datatransfer.Clipboard;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.StringSelection;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
... 30547 lines suppressed ...
--
To stop receiving notification emails like this one, please contact
geertjan@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists